Class ForwardingReplyChannel<T>
- java.lang.Object
-
- io.axoniq.axonserver.connector.impl.ForwardingReplyChannel<T>
-
- Type Parameters:
T- the message type forwarded by thisReplyChannelto the givenStreamObserver
- All Implemented Interfaces:
ReplyChannel<T>
public class ForwardingReplyChannel<T> extends Object implements ReplyChannel<T>
AReplyChannelimplementation which forwards the result of operations through to aStreamObserver.
-
-
Constructor Summary
Constructors Constructor Description ForwardingReplyChannel(String instructionId, String clientId, io.grpc.stub.StreamObserver<T> stream, Function<InstructionResult,Optional<T>> resultBuilder, Runnable onComplete)Construct aForwardingReplyChannelto forward replies to the givenstream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomplete()Marks the inbound instruction as completed.voidcompleteWithError(ErrorCategory errorCategory, String message)Marks the inbound instruction as exceptionally completed.voidcompleteWithError(ErrorMessage errorMessage)Marks the inbound instruction as exceptionally completed.voidsend(T outboundMessage)Sends the givenoutboundMessageas a reply to an incoming instruction.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.axoniq.axonserver.connector.ReplyChannel
sendAck, sendLast, sendNack, sendNack
-
-
-
-
Constructor Detail
-
ForwardingReplyChannel
public ForwardingReplyChannel(String instructionId, String clientId, io.grpc.stub.StreamObserver<T> stream, Function<InstructionResult,Optional<T>> resultBuilder, Runnable onComplete)
Construct aForwardingReplyChannelto forward replies to the givenstream.- Parameters:
instructionId- the instruction identifier used to send Result Messages. If the given instruction identifier isnullor empty, no result will be sentclientId- the client identifier used to define the error location upon acompleteWithError(ErrorCategory, String)invocationstream- theStreamObserverto forward replies of thisReplyChannelonresultBuilder- the builder function used to construct theInstructionResultmessage, used for both acknowledge the success or the failure of the operationonComplete- operation to perform when thisReplyChannelis completed, both successfully and exceptionally
-
-
Method Detail
-
send
public void send(T outboundMessage)
Description copied from interface:ReplyChannelSends the givenoutboundMessageas a reply to an incoming instruction. Where possible, the instruction identifiers should be set on the outbound message.- Specified by:
sendin interfaceReplyChannel<T>- Parameters:
outboundMessage- the message to send
-
complete
public void complete()
Description copied from interface:ReplyChannelMarks the inbound instruction as completed.- Specified by:
completein interfaceReplyChannel<T>
-
completeWithError
public void completeWithError(ErrorMessage errorMessage)
Description copied from interface:ReplyChannelMarks the inbound instruction as exceptionally completed. The givenerrorMessageshould provide sufficient information about the error.- Specified by:
completeWithErrorin interfaceReplyChannel<T>- Parameters:
errorMessage- the ErrorMessage describing the error
-
completeWithError
public void completeWithError(ErrorCategory errorCategory, String message)
Description copied from interface:ReplyChannelMarks the inbound instruction as exceptionally completed. The givenerrorCategoryandmessageshould provide sufficient information about the error.- Specified by:
completeWithErrorin interfaceReplyChannel<T>- Parameters:
errorCategory- the category that best described the error encounteredmessage- a message providing more details about the Error
-
-