T
- a message typepublic final class LocalMessageSender<T> extends Object implements MessageSender<T>
MessageSender
implementation that works on a single node.Constructor and Description |
---|
LocalMessageSender(String senderId,
String targetId,
String messageTypeId,
LocalMessageDispatcher dispatcher) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection.
|
<U> CompletableFuture<U> |
request(T message)
Send a message to corresponding
MessageListener.onMessageWithContext(T, edu.snu.coral.runtime.common.message.MessageContext) and return
a reply message. |
void |
send(T message)
Send a message to corresponding
MessageListener.onMessage(T) . |
public LocalMessageSender(String senderId, String targetId, String messageTypeId, LocalMessageDispatcher dispatcher)
public void send(T message)
MessageSender
MessageListener.onMessage(T)
. It does not guarantee whether
the message is sent successfully or not.send
in interface MessageSender<T>
message
- a messagepublic <U> CompletableFuture<U> request(T message)
MessageSender
MessageListener.onMessageWithContext(T, edu.snu.coral.runtime.common.message.MessageContext)
and return
a reply message. If there was an exception, the returned future would be failed.request
in interface MessageSender<T>
U
- reply message type.message
- a messagepublic void close() throws Exception
MessageSender
close
in interface MessageSender<T>
Exception
- while closing.Copyright © 2018. All rights reserved.