public final class LocalMessageEnvironment extends Object implements MessageEnvironment
MessageEnvironment implementation that works on a single node.
Used for unit tests.BLOCK_MANAGER_MASTER_MESSAGE_LISTENER_ID, EXECUTOR_MESSAGE_LISTENER_ID, MASTER_COMMUNICATION_ID, RUNTIME_MASTER_MESSAGE_LISTENER_ID| Constructor and Description |
|---|
LocalMessageEnvironment(String currentNodeId,
LocalMessageDispatcher dispatcher) |
| Modifier and Type | Method and Description |
|---|---|
<T> Future<MessageSender<T>> |
asyncConnect(String targetId,
String messageTypeId)
Asynchronously connect to the node called
receiverId and return a future of MessageSender
that sends messages to the listener with listenerId. |
void |
close()
Close this message environment.
|
String |
getId() |
void |
removeListener(String listenerId)
Remove the
MessageListener bound to a specific listener ID. |
<T> void |
setupListener(String listenerId,
MessageListener<T> listener)
Set up a
MessageListener with a listener id. |
public LocalMessageEnvironment(String currentNodeId, LocalMessageDispatcher dispatcher)
public <T> void setupListener(String listenerId, MessageListener<T> listener)
MessageEnvironmentMessageListener with a listener id.setupListener in interface MessageEnvironmentT - The type of the message to be sent in the environmentlistenerId - an identifier of the message listenerlistener - a message listenerpublic void removeListener(String listenerId)
MessageEnvironmentMessageListener bound to a specific listener ID.removeListener in interface MessageEnvironmentlistenerId - the ID of the listener to remove.public <T> Future<MessageSender<T>> asyncConnect(String targetId, String messageTypeId)
MessageEnvironmentreceiverId and return a future of MessageSender
that sends messages to the listener with listenerId.asyncConnect in interface MessageEnvironmentT - The type of the message to be sent in the environmenttargetId - a receiver idmessageTypeId - an identifier of the message listenerpublic String getId()
public void close()
MessageEnvironmentclose in interface MessageEnvironmentCopyright © 2018. All rights reserved.