Class BufferingReplyChannel<T>

  • Type Parameters:
    T - the type of messages this ReplyChannel deals with
    All Implemented Interfaces:
    ReplyChannel<T>

    public class BufferingReplyChannel<T>
    extends Object
    implements ReplyChannel<T>
    A ReplyChannel implementation that uses a given buffer to buffer send, complete and complete-with-error. ACKs and NACKs are delegated via delegate ReplyChannel.
    Since:
    4.6.0
    Author:
    Milan Savic, Stefan Dragisic, Allard Buijze
    • Constructor Detail

      • BufferingReplyChannel

        public BufferingReplyChannel​(ReplyChannel<T> delegate,
                                     CloseableBuffer<T> buffer)
        Instantiates this BufferingReplyChannel with given delegate and buffer.
        Parameters:
        delegate - used to delegate acks and nacks
        buffer - used to buffer sends, completes and completes with error
    • Method Detail

      • send

        public void send​(T outboundMessage)
        Description copied from interface: ReplyChannel
        Sends the given outboundMessage as a reply to an incoming instruction. Where possible, the instruction identifiers should be set on the outbound message.
        Specified by:
        send in interface ReplyChannel<T>
        Parameters:
        outboundMessage - the message to send
      • sendAck

        public void sendAck()
        Description copied from interface: ReplyChannel
        Sends 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:
        sendAck in interface ReplyChannel<T>
        See Also:
        ReplyChannel.complete()
      • complete

        public void complete()
        Description copied from interface: ReplyChannel
        Marks the inbound instruction as completed.
        Specified by:
        complete in interface ReplyChannel<T>
      • completeWithError

        public void completeWithError​(ErrorMessage errorMessage)
        Description copied from interface: ReplyChannel
        Marks the inbound instruction as exceptionally completed. The given errorMessage should provide sufficient information about the error.
        Specified by:
        completeWithError in interface ReplyChannel<T>
        Parameters:
        errorMessage - the ErrorMessage describing the error
      • completeWithError

        public void completeWithError​(ErrorCategory errorCategory,
                                      String message)
        Description copied from interface: ReplyChannel
        Marks the inbound instruction as exceptionally completed. The given errorCategory and message should provide sufficient information about the error.
        Specified by:
        completeWithError in interface ReplyChannel<T>
        Parameters:
        errorCategory - the category that best described the error encountered
        message - a message providing more details about the Error