public interface HubConnection
ClientProfile object.
It is good practice to call unregister() when the connection
is finished with; however if it is not called explicitly, the
connection will unregister itself on object finalisation or JVM termination,
as long as the JVM shuts down cleanly.
| Modifier and Type | Method and Description |
|---|---|
String |
call(String recipientId,
String msgTag,
Map msg)
Sends a message to a given client expecting a response.
|
Map |
callAll(String msgTag,
Map msg)
Sends a message to all subscribed clients expecting responses.
|
Response |
callAndWait(String recipientId,
Map msg,
int timeout)
Sends a message synchronously to a client, waiting for the response.
|
void |
declareMetadata(Map meta)
Declares this registered client's metadata.
|
void |
declareSubscriptions(Map subs)
Declares this registered client's MType subscriptions.
|
Metadata |
getMetadata(String clientId)
Returns the metadata for another registered client.
|
RegInfo |
getRegInfo()
Returns the registration information associated with this connection.
|
String[] |
getRegisteredClients()
Returns the list of client public IDs for those clients currently
registered.
|
Map |
getSubscribedClients(String mtype)
Returns a map of subscriptions for a given MType.
|
Subscriptions |
getSubscriptions(String clientId)
Returns the subscriptions for another registered client.
|
void |
notify(String recipientId,
Map msg)
Sends a message to a given client without wanting a response.
|
List |
notifyAll(Map msg)
Sends a message to all subscribed clients without wanting a response.
|
void |
ping()
Tests whether the connection is currently open.
|
void |
reply(String msgId,
Map response)
Supplies a response to a previously received message.
|
void |
setCallable(CallableClient callable)
Tells the hub how it can perform callbacks on the client by providing
a CallableClient object.
|
void |
unregister()
Unregisters the client and terminates this connection.
|
RegInfo getRegInfo()
void setCallable(CallableClient callable) throws SampException
callable - callable clientSampExceptionvoid ping() throws SampException
SampException - if the hub has disappeared or communications
are disrupted in some other wayvoid unregister()
throws SampException
SampExceptionvoid declareMetadata(Map meta) throws SampException
meta - Metadata-like mapSampExceptionMetadata getMetadata(String clientId) throws SampException
clientId - public id for another registered clientSampExceptionvoid declareSubscriptions(Map subs) throws SampException
Only permitted if this client is already callable.
subs - Subscriptions-like mapSampExceptionSubscriptions getSubscriptions(String clientId) throws SampException
clientId - public id for another registered clientSampExceptionString[] getRegisteredClients() throws SampException
SampExceptionMap getSubscribedClients(String mtype) throws SampException
mtype - MTypemtypeSampExceptionvoid notify(String recipientId, Map msg) throws SampException
recipientId - public-id of client to receive messagemsg - Message-like mapSampExceptionList notifyAll(Map msg) throws SampException
msg - Message-like mapSampExceptionString call(String recipientId, String msgTag, Map msg) throws SampException
receiveResponse method of this connection's
CallableClient will be called with a
response at some time in the future.
Only permitted if this client is already callable.
recipientId - public-id of client to receive messagemsgTag - arbitrary string tagging this message for caller's
benefitmsg - Message-like mapSampExceptionMap callAll(String msgTag, Map msg) throws SampException
receiveResponse method of this connection's
CallableClient will be called with responses at some
time in the future.
Only permitted if this client is already callable.
msgTag - arbitrary string tagging this message for caller's
benefitmsg - Message-like mapSampExceptionResponse callAndWait(String recipientId, Map msg, int timeout) throws SampException
timeout
parameter, an exception will result.recipientId - public-id of client to receive messagemsg - Message-like maptimeout - timeout in seconds, or <0 for no timeoutSampExceptionvoid reply(String msgId, Map response) throws SampException
msgId - ID associated with earlier sendresponse - Response-like mapSampExceptionCopyright © 2008–2024. All rights reserved.