T - the outgoing message typeR - the reply message typepublic class SimpleConversationChannel<T extends ConversationMessage,R extends ConversationMessage> extends Object implements ConversationChannel<T,R>
ConversationChannel.EMPTY| Constructor and Description |
|---|
SimpleConversationChannel(Messenger messenger,
String name,
com.google.common.reflect.TypeToken<T> outgoingType,
com.google.common.reflect.TypeToken<R> replyType) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this resource.
|
String |
getName()
Gets the name of the channel.
|
Channel<T> |
getOutgoingChannel()
Gets the channel for primary outgoing messages.
|
Channel<R> |
getReplyChannel()
Gets the channel replies are sent on.
|
ConversationChannelAgent<T,R> |
newAgent()
Creates a new
ConversationChannelAgent for this channel. |
Promise<Void> |
sendMessage(T message,
ConversationReplyListener<R> replyListener,
long timeoutDuration,
TimeUnit unit)
Sends a new message to the channel.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnewAgentbindWith, closeAndReportException, closeSilently, isClosed@Nonnull public String getName()
ConversationChannelgetName in interface ConversationChannel<T extends ConversationMessage,R extends ConversationMessage>@Nonnull public Channel<T> getOutgoingChannel()
ConversationChannelgetOutgoingChannel in interface ConversationChannel<T extends ConversationMessage,R extends ConversationMessage>@Nonnull public Channel<R> getReplyChannel()
ConversationChannelgetReplyChannel in interface ConversationChannel<T extends ConversationMessage,R extends ConversationMessage>@Nonnull public ConversationChannelAgent<T,R> newAgent()
ConversationChannelConversationChannelAgent for this channel.newAgent in interface ConversationChannel<T extends ConversationMessage,R extends ConversationMessage>@Nonnull public Promise<Void> sendMessage(@Nonnull T message, @Nonnull ConversationReplyListener<R> replyListener, long timeoutDuration, @Nonnull TimeUnit unit)
ConversationChannelThis method will return immediately, and the promise will be completed once the message has been sent.
sendMessage in interface ConversationChannel<T extends ConversationMessage,R extends ConversationMessage>message - the message to dispatchreplyListener - the reply listenertimeoutDuration - the timeout duration for the reply listenerunit - the unit of timeoutDurationpublic void close()
Terminableclose in interface AutoCloseableclose in interface ConversationChannel<T extends ConversationMessage,R extends ConversationMessage>close in interface TerminableCopyright © 2022. All rights reserved.