T - the outgoing message typeR - the reply message typepublic interface ConversationChannel<T extends ConversationMessage,R extends ConversationMessage> extends Terminable
Channel providing an abstraction for two-way "conversations".EMPTY| 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. |
default ConversationChannelAgent<T,R> |
newAgent(ConversationChannelListener<T,R> listener)
Creates a new
ConversationChannelAgent for this channel, and
immediately adds the given ConversationChannelListener to it. |
Promise<Void> |
sendMessage(T message,
ConversationReplyListener<R> replyListener,
long timeoutDuration,
TimeUnit unit)
Sends a new message to the channel.
|
bindWith, closeAndReportException, closeSilently, isClosed@Nonnull Channel<T> getOutgoingChannel()
@Nonnull Channel<R> getReplyChannel()
@Nonnull ConversationChannelAgent<T,R> newAgent()
ConversationChannelAgent for this channel.@Nonnull default ConversationChannelAgent<T,R> newAgent(ConversationChannelListener<T,R> listener)
ConversationChannelAgent for this channel, and
immediately adds the given ConversationChannelListener to it.listener - the listener to register@Nonnull Promise<Void> sendMessage(@Nonnull T message, @Nonnull ConversationReplyListener<R> replyListener, long timeoutDuration, @Nonnull TimeUnit unit)
This method will return immediately, and the promise will be completed once the message has been sent.
message - the message to dispatchreplyListener - the reply listenertimeoutDuration - the timeout duration for the reply listenerunit - the unit of timeoutDurationvoid close()
Terminableclose in interface AutoCloseableclose in interface TerminableCopyright © 2022. All rights reserved.