public interface GroupMember
DistributedGroup member representing a member of the group controlled by a local
or remote process.| Modifier and Type | Interface and Description |
|---|---|
static class |
GroupMember.Status
Status constants for indicating whether a member is currently connected to the group.
|
| Modifier and Type | Method and Description |
|---|---|
String |
id()
Returns the member ID.
|
MessageClient |
messaging()
Returns the direct message client for this member.
|
<T> Optional<T> |
metadata()
Returns the metadata associated with this member.
|
Listener<GroupMember.Status> |
onStatusChange(Consumer<GroupMember.Status> callback)
Registers a member status change listener.
|
GroupMember.Status |
status()
Returns the member's last known status.
|
String id()
The member ID is guaranteed to be unique across the cluster. Depending on how the member was
constructed, it may be a user-provided identifier or an automatically generated UUID.
GroupMember.Status status()
The member's status indicates whether the member is GroupMember.Status.ALIVE or GroupMember.Status.DEAD based
on whether the member's session is open. Note that the consistency of client-side events is
SEQUENTIAL, meaning all group instances will see status changes in the same order some time
after the event actually occurred (asynchronously). So, even if a member's status is GroupMember.Status.DEAD
from the perspective of one node, it may be GroupMember.Status.ALIVE from the perspective of another.
Users should elect leaders to coordinate change in response to member status changes.
Listener<GroupMember.Status> onStatusChange(Consumer<GroupMember.Status> callback)
The status change listener will be called when a member's session expires.
The member's status indicates whether the member is GroupMember.Status.ALIVE or GroupMember.Status.DEAD based
on whether the member's session is open. Note that the consistency of client-side events is
SEQUENTIAL, meaning all group instances will see status changes in the same order some time
after the event actually occurred (asynchronously). So, even if a member's status is GroupMember.Status.DEAD
from the perspective of one node, it may be GroupMember.Status.ALIVE from the perspective of another.
Users should elect leaders to coordinate change in response to member status changes.
callback - The callback to be called when the member's status changes.MessageClient messaging()
The message client can be used to send direct messages to this member. To send a direct message, create
a producer via the returned MessageClient.
GroupMember member = group.member("foo");
MessageProducer<String> producer = member.messaging().producer("bar");
producer.send("baz");
<T> Optional<T> metadata()
Metadata is provided when the member joins the group. If metadata was
provided by the member when it joined the group, it is guaranteed to be visible to all nodes once the member
has been added to the group.
T - The metadata type.Copyright © 2013–2017. All rights reserved.