Interface MessageEnvironment
-
- All Known Implementing Classes:
GrpcMessageEnvironment
,LocalMessageEnvironment
,NcsMessageEnvironment
@DefaultImplementation(GrpcMessageEnvironment.class) public interface MessageEnvironment
Set upMessageListener
s to handle incoming messages on this node, and connect to remote nodes and returnMessageSender
s to send message to them.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BLOCK_MANAGER_MASTER_MESSAGE_LISTENER_ID
static java.lang.String
EXECUTOR_MESSAGE_LISTENER_ID
static java.lang.String
MASTER_COMMUNICATION_ID
static java.lang.String
PIPE_MANAGER_MASTER_MESSAGE_LISTENER_ID
static java.lang.String
RUNTIME_MASTER_MESSAGE_LISTENER_ID
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> java.util.concurrent.Future<MessageSender<T>>
asyncConnect(java.lang.String receiverId, java.lang.String listenerId)
Asynchronously connect to the node calledreceiverId
and return a future ofMessageSender
that sends messages to the listener withlistenerId
.void
close()
Close this message environment.java.lang.String
getId()
void
removeListener(java.lang.String listenerId)
Remove theMessageListener
bound to a specific listener ID.<T> void
setupListener(java.lang.String listenerId, MessageListener<T> listener)
Set up aMessageListener
with a listener id.
-
-
-
Field Detail
-
MASTER_COMMUNICATION_ID
static final java.lang.String MASTER_COMMUNICATION_ID
- See Also:
- Constant Field Values
-
RUNTIME_MASTER_MESSAGE_LISTENER_ID
static final java.lang.String RUNTIME_MASTER_MESSAGE_LISTENER_ID
- See Also:
- Constant Field Values
-
BLOCK_MANAGER_MASTER_MESSAGE_LISTENER_ID
static final java.lang.String BLOCK_MANAGER_MASTER_MESSAGE_LISTENER_ID
- See Also:
- Constant Field Values
-
PIPE_MANAGER_MASTER_MESSAGE_LISTENER_ID
static final java.lang.String PIPE_MANAGER_MASTER_MESSAGE_LISTENER_ID
- See Also:
- Constant Field Values
-
EXECUTOR_MESSAGE_LISTENER_ID
static final java.lang.String EXECUTOR_MESSAGE_LISTENER_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
setupListener
<T> void setupListener(java.lang.String listenerId, MessageListener<T> listener)
Set up aMessageListener
with a listener id.- Type Parameters:
T
- The type of the message to be sent in the environment- Parameters:
listenerId
- an identifier of the message listenerlistener
- a message listener
-
removeListener
void removeListener(java.lang.String listenerId)
Remove theMessageListener
bound to a specific listener ID.- Parameters:
listenerId
- the ID of the listener to remove.
-
asyncConnect
<T> java.util.concurrent.Future<MessageSender<T>> asyncConnect(java.lang.String receiverId, java.lang.String listenerId)
Asynchronously connect to the node calledreceiverId
and return a future ofMessageSender
that sends messages to the listener withlistenerId
.- Type Parameters:
T
- The type of the message to be sent in the environment- Parameters:
receiverId
- a receiver idlistenerId
- an identifier of the message listener- Returns:
- a message sender
-
close
void close() throws java.lang.Exception
Close this message environment.- Throws:
java.lang.Exception
- while closing
-
getId
java.lang.String getId()
- Returns:
- identifier for this node
-
-