public abstract class MessageDispatcher
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Class and Description |
|---|---|
static interface |
MessageDispatcher.DeliveryCallback
A callback interface for successful delivery of messages.
|
static interface |
MessageDispatcher.ErrorCallback
A callback interface for errors in delivery of messages.
|
| Constructor and Description |
|---|
MessageDispatcher() |
| Modifier and Type | Method and Description |
|---|---|
static MessageDispatcher |
getMessageDispatcher(DirectlyConnectedDevice directlyConnectedDevice)
Get the instance of a MessageDispatcher for the DirectlyConnectedDevice.
|
abstract RequestDispatcher |
getRequestDispatcher()
Get the RequestDispatcher that is used by this MessageDispatcher for
handling RequestMessages.
|
abstract void |
offer(Message... messages)
Offer messages to be queued.
|
void |
offer(Message message)
Offer a message to be queued.
|
abstract void |
queue(Message... messages)
Add the messages to the outgoing message queue if it is possible to
do so without violating capacity restrictions.
|
void |
queue(Message message)
Add the message to the outgoing message queue if it is possible to
do so without violating capacity restrictions.
|
static MessageDispatcher |
removeMessageDispatcher(DirectlyConnectedDevice directlyConnectedDevice)
Remove the instance of a MessageDispatcher for the DirectlyConnectedDevice.
|
static void |
setMessageDispatcher(DirectlyConnectedDevice directlyConnectedDevice,
MessageDispatcher messageDispatcher)
Set the instance of a MessageDispatcher for the DirectlyConnectedDevice.
|
abstract void |
setOnDelivery(MessageDispatcher.DeliveryCallback callback)
Set a callback to be notified if message is successfully delivered.
|
abstract void |
setOnError(MessageDispatcher.ErrorCallback callback)
Set a callback to be notified if there is an error in dispatching.
|
public static MessageDispatcher getMessageDispatcher(DirectlyConnectedDevice directlyConnectedDevice)
directlyConnectedDevice - is a gateway or directly connected devicepublic static void setMessageDispatcher(DirectlyConnectedDevice directlyConnectedDevice, MessageDispatcher messageDispatcher)
directlyConnectedDevice - is a gateway or directly connected devicemessageDispatcher - is the MessageDispatcher for the directly connected devicepublic static MessageDispatcher removeMessageDispatcher(DirectlyConnectedDevice directlyConnectedDevice)
removeMessageDispatcher, a call to getMessageDispatcher(DirectlyConnectedDevice)
will return null.
This is an implementation detail and is called from the implementation of
the virtualization API.directlyConnectedDevice - is a gateway or directly connected devicenullpublic abstract RequestDispatcher getRequestDispatcher()
RequestDispatcherpublic abstract void queue(Message... messages)
messages - The messages to be queuedjava.lang.ArrayStoreException - if all the messages cannot be added to the queuejava.lang.IllegalArgumentException - if messages is null or emptypublic void queue(Message message)
message - The message to be queuedjava.lang.ArrayStoreException - if the message cannot be added to the queuejava.lang.IllegalArgumentException - if the message is nullpublic abstract void offer(Message... messages)
messages - The messages to be queuedjava.lang.ArrayStoreException - if all the messages cannot be added to the queuejava.lang.IllegalArgumentException - if messages is null or emptypublic void offer(Message message)
message - The message to be queuedjava.lang.ArrayStoreException - if all the messages cannot be added to the queuejava.lang.IllegalArgumentException - if messages is null or emptypublic abstract void setOnError(MessageDispatcher.ErrorCallback callback)
callback - callback to invoke, if null,
the existing callback will be removedpublic abstract void setOnDelivery(MessageDispatcher.DeliveryCallback callback)
callback - callback to invoke, if null,
the existing callback will be removed