Class LocalMessageSender<T>
- java.lang.Object
-
- org.apache.nemo.runtime.common.message.local.LocalMessageSender<T>
-
- Type Parameters:
T
- a message type
- All Implemented Interfaces:
MessageSender<T>
public final class LocalMessageSender<T> extends java.lang.Object implements MessageSender<T>
A simpleMessageSender
implementation that works on a single node.
-
-
Constructor Summary
Constructors Constructor Description LocalMessageSender(java.lang.String senderId, java.lang.String targetId, java.lang.String messageTypeId, LocalMessageDispatcher dispatcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the connection.<U> java.util.concurrent.CompletableFuture<U>
request(T message)
Send a message to correspondingMessageListener.onMessageWithContext(T, org.apache.nemo.runtime.common.message.MessageContext)
and return a reply message.void
send(T message)
Send a message to correspondingMessageListener.onMessage(T)
.
-
-
-
Constructor Detail
-
LocalMessageSender
public LocalMessageSender(java.lang.String senderId, java.lang.String targetId, java.lang.String messageTypeId, LocalMessageDispatcher dispatcher)
-
-
Method Detail
-
send
public void send(T message)
Description copied from interface:MessageSender
Send a message to correspondingMessageListener.onMessage(T)
. It does not guarantee whether the message is sent successfully or not.- Specified by:
send
in interfaceMessageSender<T>
- Parameters:
message
- a message
-
request
public <U> java.util.concurrent.CompletableFuture<U> request(T message)
Description copied from interface:MessageSender
Send a message to correspondingMessageListener.onMessageWithContext(T, org.apache.nemo.runtime.common.message.MessageContext)
and return a reply message. If there was an exception, the returned future would be failed.- Specified by:
request
in interfaceMessageSender<T>
- Type Parameters:
U
- reply message type.- Parameters:
message
- a message- Returns:
- a future
-
close
public void close() throws java.lang.Exception
Description copied from interface:MessageSender
Closes the connection.- Specified by:
close
in interfaceMessageSender<T>
- Throws:
java.lang.Exception
-
-