@DefaultImplementation(value=NcsMessageEnvironment.class) public interface MessageEnvironment
MessageListener
s to handle incoming messages on this node, and connect to remote nodes and return
MessageSender
s to send message to them.Modifier and Type | Field and Description |
---|---|
static String |
BLOCK_MANAGER_MASTER_MESSAGE_LISTENER_ID |
static String |
EXECUTOR_MESSAGE_LISTENER_ID |
static String |
MASTER_COMMUNICATION_ID |
static String |
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.
|
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. |
static final String MASTER_COMMUNICATION_ID
static final String RUNTIME_MASTER_MESSAGE_LISTENER_ID
static final String BLOCK_MANAGER_MASTER_MESSAGE_LISTENER_ID
static final String EXECUTOR_MESSAGE_LISTENER_ID
<T> void setupListener(String listenerId, MessageListener<T> listener)
MessageListener
with a listener id.T
- The type of the message to be sent in the environmentlistenerId
- an identifier of the message listenerlistener
- a message listenervoid removeListener(String listenerId)
MessageListener
bound to a specific listener ID.listenerId
- the ID of the listener to remove.<T> Future<MessageSender<T>> asyncConnect(String receiverId, String listenerId)
receiverId
and return a future of MessageSender
that sends messages to the listener with listenerId
.T
- The type of the message to be sent in the environmentreceiverId
- a receiver idlistenerId
- an identifier of the message listenerCopyright © 2018. All rights reserved.