T - the message type forwarded by this ReplyChannel to the given StreamObserverpublic class ForwardingReplyChannel<T> extends Object implements ReplyChannel<T>
ReplyChannel implementation which forwards send(Object), sendAck() and sendNack(ErrorMessage) operations through to a StreamObserver.| Constructor and Description |
|---|
ForwardingReplyChannel(String instructionId,
String clientId,
io.grpc.stub.StreamObserver<T> stream,
Function<InstructionAck,T> ackBuilder,
Runnable onComplete)
Construct a
ForwardingReplyChannel to forward replies to the given stream. |
| 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.
|
void |
send(T outboundMessage)
Sends the given
outboundMessage as a reply to an incoming instruction. |
void |
sendAck()
Sends an receipt acknowledgement if one hasn't been sent yet for this instruction.
|
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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsendLast, sendNackpublic ForwardingReplyChannel(String instructionId, String clientId, io.grpc.stub.StreamObserver<T> stream, Function<InstructionAck,T> ackBuilder, Runnable onComplete)
ForwardingReplyChannel to forward replies to the given stream.instructionId - the instruction identifier used to send ACK or NACK messages. If the given instruction
identifier is null or empty, no ACK/NACK will be sendclientId - the client identifier used to define the error location upon a completeWithError(ErrorCategory, String) invocationstream - the StreamObserver to forward replies of this ReplyChannel onackBuilder - the builder function used to construct the InstructionAck message, used for both a
sendAck() and ReplyChannel.sendNack()onComplete - operation to perform when this this ReplyChannel is completed, both successfully and
exceptionallypublic 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 sendAck()
ReplyChannelReplyChannel.complete() method is invoked.
If the incoming instruction has no instruction ID, this method does nothing.
sendAck in interface ReplyChannel<T>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 sendNack(ErrorMessage errorMessage)
ReplyChannelerrorMessage to describe the reason. If not explicitly sent, it will be send once the ReplyChannel.completeWithError(ErrorMessage) or ReplyChannel.completeWithError(ErrorCategory, String) methods are invoked. 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>public 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 ErrorCopyright © 2020–2021 AxonIQ BV. All rights reserved.