public interface ClientGroup
By organising clients into groups it is possible to send messages to a group of clients rather than simply publishing to all clients.
Client groups may be created and maintained via a TopicProvider
.
Every client group has a name that is unique to the Topic Provider that
created it.
A client may be added to more than one group if required.
Modifier and Type | Method and Description |
---|---|
boolean |
addClient(TopicClient client)
Adds a client to the group.
|
void |
close()
Closes the group, after which point it may no longer be used.
|
boolean |
containsClient(TopicClient client)
Returns true if the client is contained within the group.
|
List<TopicClient> |
getClients()
Returns a snapshot of all of the clients currently in the group.
|
String |
getName()
Returns the name of the client group.
|
TopicProvider |
getTopicProvider()
Returns the Topic Provider that owns the group.
|
ClientGroup |
intersect(ClientGroup group)
Returns a temporary client group which is the intersection between the
two groups.
|
boolean |
isClosed()
Indicates whether the group is closed.
|
void |
removeAllClients()
Removes all clients from the group.
|
boolean |
removeClient(TopicClient client)
Removes a client from the group.
|
void |
send(TopicMessage message)
Send a message to all clients in the group.
|
void |
send(TopicMessage message,
MessagePriority priority)
Send a message to all clients in the group, specifying a delivery
priority.
|
void |
sendExclusive(TopicMessage message,
TopicClient excludeClient)
Send an exclusive message, i.e.
|
void |
sendExclusive(TopicMessage message,
TopicClient excludeClient,
MessagePriority priority)
Send an exclusive message, i.e.
|
ClientGroup |
union(ClientGroup group)
Returns a temporary client group which is the union between the two
groups.
|
String getName()
The name of the client is unique within its TopicProvider
.
TopicProvider getTopicProvider()
void send(TopicMessage message) throws APIException
message
- the message to send.APIException
- if unable to send.void sendExclusive(TopicMessage message, TopicClient excludeClient) throws APIException
message
- the message to send.excludeClient
- the client to excludeAPIException
- if unable to publish messagevoid send(TopicMessage message, MessagePriority priority) throws APIException
message
- the message to send.priority
- the delivery priorityAPIException
- if unable to send.void sendExclusive(TopicMessage message, TopicClient excludeClient, MessagePriority priority) throws APIException
message
- the message to send.excludeClient
- the client to excludepriority
- delivery priorityAPIException
- if unable to publish messageboolean removeClient(TopicClient client)
client
- the client to remove.boolean addClient(TopicClient client)
Unified API Clients are not valid for adding to Client Groups. Attempting to add one will have no effect.
client
- the client to add.List<TopicClient> getClients()
void removeAllClients()
This is not the same as closing the group as it is possible to subsequently add more clients.
void close()
Closing the group removes it from its owning TopicProvider
and
removes all clients from it.
A group should be closed if there is no intention of using it again as it will then no longer be considered when handling groups.
boolean isClosed()
boolean containsClient(TopicClient client)
client
- the client to checkClientGroup union(ClientGroup group)
group
- the client group in which to perform the unionClientGroup intersect(ClientGroup group)
group
- the client group into which to perform the intersectionCopyright © 2016 Push Technology Ltd. All Rights Reserved.