public final class NcsMessageEnvironment extends Object implements MessageEnvironment
BLOCK_MANAGER_MASTER_MESSAGE_LISTENER_ID, EXECUTOR_MESSAGE_LISTENER_ID, MASTER_COMMUNICATION_ID, RUNTIME_MASTER_MESSAGE_LISTENER_ID
Modifier and Type | Method and Description |
---|---|
<T> Future<MessageSender<T>> |
asyncConnect(String receiverId,
String listenerId)
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 <T> void setupListener(String listenerId, MessageListener<T> listener)
MessageEnvironment
MessageListener
with a listener id.setupListener
in interface MessageEnvironment
T
- The type of the message to be sent in the environmentlistenerId
- an identifier of the message listenerlistener
- a message listenerpublic void removeListener(String listenerId)
MessageEnvironment
MessageListener
bound to a specific listener ID.removeListener
in interface MessageEnvironment
listenerId
- the ID of the listener to remove.public <T> Future<MessageSender<T>> asyncConnect(String receiverId, String listenerId)
MessageEnvironment
receiverId
and return a future of MessageSender
that sends messages to the listener with listenerId
.asyncConnect
in interface MessageEnvironment
T
- The type of the message to be sent in the environmentreceiverId
- a receiver idlistenerId
- an identifier of the message listenerpublic String getId()
public void close() throws Exception
MessageEnvironment
close
in interface MessageEnvironment
Exception
- while closingCopyright © 2018. All rights reserved.