Class BufferingReplyChannel<T>
- java.lang.Object
-
- io.axoniq.axonserver.connector.impl.BufferingReplyChannel<T>
-
- Type Parameters:
T- the type of messages thisReplyChanneldeals with
- All Implemented Interfaces:
ReplyChannel<T>
public class BufferingReplyChannel<T> extends Object implements ReplyChannel<T>
AReplyChannelimplementation that uses a givenbufferto buffer send, complete and complete-with-error.ACKs andNACKs are delegated viadelegate ReplyChannel.- Since:
- 4.6.0
- Author:
- Milan Savic, Stefan Dragisic, Allard Buijze
-
-
Constructor Summary
Constructors Constructor Description BufferingReplyChannel(ReplyChannel<T> delegate, CloseableBuffer<T> buffer)
-
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.voidsendAck()Sends a receipt acknowledgement if one hasn't been sent yet for this instruction.voidsendNack(ErrorMessage errorMessage)Sends a negative acknowledgement, indicating that the incoming message could not be handled as expected, using givenerrorMessageto describe the reason.-
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
sendLast, sendNack
-
-
-
-
Constructor Detail
-
BufferingReplyChannel
public BufferingReplyChannel(ReplyChannel<T> delegate, CloseableBuffer<T> buffer)
- Parameters:
delegate- used to delegateacks andnacksbuffer- used to buffer sends, completes and completes with error
-
-
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
-
sendAck
public void sendAck()
Description copied from interface:ReplyChannelSends a receipt acknowledgement if one hasn't been sent yet for this instruction. If the incoming instruction has no instruction ID, this method does nothing.- Specified by:
sendAckin interfaceReplyChannel<T>- See Also:
ReplyChannel.complete()
-
sendNack
public void sendNack(ErrorMessage errorMessage)
Description copied from interface:ReplyChannelSends a negative acknowledgement, indicating that the incoming message could not be handled as expected, using givenerrorMessageto describe the reason. The givenerrorMessageshould provide sufficient information about the error. If the incoming instruction has no instruction ID, this method does nothing.- Specified by:
sendNackin interfaceReplyChannel<T>- See Also:
ReplyChannel.completeWithError(ErrorMessage),ReplyChannel.completeWithError(ErrorCategory, String)
-
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
-
-