Interface MessageSender<T>
-
- Type Parameters:
T
- message type
- All Known Implementing Classes:
FailedMessageSender
,LocalMessageSender
public interface MessageSender<T>
This class sends messages toMessageListener
with some defined semantics.
-
-
Method Summary
All Methods Instance Methods Abstract 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)
.
-
-
-
Method Detail
-
send
void send(T message)
Send a message to correspondingMessageListener.onMessage(T)
. It does not guarantee whether the message is sent successfully or not.- Parameters:
message
- a message
-
request
<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. If there was an exception, the returned future would be failed.- Type Parameters:
U
- reply message type.- Parameters:
message
- a message- Returns:
- a future
-
close
void close() throws java.lang.Throwable
Closes the connection.- Throws:
java.lang.Throwable
- while closing.
-
-