T - the type of messages flowing through this ReplyChannelpublic class CloseAwareReplyChannel<T> extends Object implements ReplyChannel<T>
ReplyChannel implementation that will trigger a given action when it is closed.| Constructor and Description |
|---|
CloseAwareReplyChannel(ReplyChannel<T> delegate)
Instantiates this
ReplyChannel with given delegate. |
CloseAwareReplyChannel(ReplyChannel<T> delegate,
Runnable onClose)
Instantiates this
ReplyChannel with given delegate and onClose Runnable execution
to be executed once the channel is closed. |
| Modifier and Type | Method and Description |
|---|---|
void |
complete()
Marks the inbound instruction as completed.
|
void |
completeWithError(ErrorCategory errorCategory,
String message)
Marks the inbound instruction as exceptionally completed.
|
void |
completeWithError(ErrorMessage errorMessage)
Marks the inbound instruction as exceptionally completed.
|
boolean |
isClosed()
Indicates whether this
ReplyChannel is closed. |
void |
send(T outboundMessage)
Sends the given
outboundMessage as a reply to an incoming instruction. |
void |
sendAck()
Sends a receipt acknowledgement if one hasn't been sent yet for this instruction.
|
void |
sendLast(T outboundMessage)
Sends the given
response and marks the processing as completed, possibly signalling flow control that
more query messages may be sent. |
void |
sendNack()
Sends a negative acknowledgement, indicating that the incoming message could not be handled as expected.
|
void |
sendNack(ErrorMessage errorMessage)
Sends a negative acknowledgement, indicating that the incoming message could not be handled as expected, using
given
errorMessage to describe the reason. |
public CloseAwareReplyChannel(ReplyChannel<T> delegate)
ReplyChannel with given delegate.delegate - the delegatepublic CloseAwareReplyChannel(ReplyChannel<T> delegate, Runnable onClose)
ReplyChannel with given delegate and onClose Runnable execution
to be executed once the channel is closed.delegate - the delegateonClose - to be executed when channel is closedpublic void send(T outboundMessage)
ReplyChanneloutboundMessage as a reply to an incoming instruction. Where possible, the instruction
identifiers should be set on the outbound message.send in interface ReplyChannel<T>outboundMessage - the message to sendpublic void sendLast(T outboundMessage)
ReplyChannelresponse and marks the processing as completed, possibly signalling flow control that
more query messages may be sent.
No more responses should be sent after invoking this method. The behavior in that case is undefined, and these messages are likely to be ignored.
sendLast in interface ReplyChannel<T>public void sendAck()
ReplyChannelsendAck in interface ReplyChannel<T>ReplyChannel.complete()public void sendNack()
ReplyChannelReplyChannel.sendNack(ErrorMessage), no specific error details are provided.
If the incoming instruction has no instruction ID, this method does nothing.sendNack in interface ReplyChannel<T>ReplyChannel.completeWithError(ErrorMessage),
ReplyChannel.completeWithError(ErrorCategory, String)public void sendNack(ErrorMessage errorMessage)
ReplyChannelerrorMessage to describe the reason. The given errorMessage should provide sufficient
information about the error. If the incoming instruction has no instruction ID, this method does nothing.sendNack in interface ReplyChannel<T>ReplyChannel.completeWithError(ErrorMessage),
ReplyChannel.completeWithError(ErrorCategory, String)public void complete()
ReplyChannelcomplete in interface ReplyChannel<T>public void completeWithError(ErrorMessage errorMessage)
ReplyChannelerrorMessage should provide
sufficient information about the error.completeWithError in interface ReplyChannel<T>errorMessage - the ErrorMessage describing the errorpublic void completeWithError(ErrorCategory errorCategory, String message)
ReplyChannelerrorCategory and message
should provide sufficient information about the error.completeWithError in interface ReplyChannel<T>errorCategory - the category that best described the error encounteredmessage - a message providing more details about the Errorpublic boolean isClosed()
ReplyChannel is closed.true if closed, false otherwiseCopyright © 2020–2022 AxonIQ BV. All rights reserved.