Interface ReplyChannel<T>

  • Type Parameters:
    T - the type of message expected on this ReplyChannel
    All Known Implementing Classes:
    BufferingReplyChannel, CloseAwareReplyChannel, ForwardingReplyChannel

    public interface ReplyChannel<T>
    Interface providing access to the communication channel to send replies to incoming instructions. All instructions must be acknowledged by completing the reply channel after successfully sending all necessary replies.

    One should not send messages after completing the reply channel. The behavior is such a case is undefined.

    • Method Detail

      • send

        void send​(T outboundMessage)
        Sends the given outboundMessage as a reply to an incoming instruction. Where possible, the instruction identifiers should be set on the outbound message.
        Parameters:
        outboundMessage - the message to send
        Implementation Note:
        Implementations are encouraged to validate and correct these instruction identifiers.
      • sendLast

        default 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.

        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.

      • sendAck

        @Deprecated
        default void sendAck()
        Deprecated.
        This method is deprecated because it is not needed anymore, as the complete() already sends positive result, indicating that the incoming message has been handled as expected.
        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.
        See Also:
        complete()
      • complete

        void complete()
        Marks the inbound instruction as completed.
      • completeWithError

        void completeWithError​(ErrorMessage errorMessage)
        Marks the inbound instruction as exceptionally completed. The given errorMessage should provide sufficient information about the error.
        Parameters:
        errorMessage - the ErrorMessage describing the error
      • completeWithError

        void completeWithError​(ErrorCategory errorCategory,
                               String message)
        Marks the inbound instruction as exceptionally completed. The given errorCategory and message should provide sufficient information about the error.
        Parameters:
        errorCategory - the category that best described the error encountered
        message - a message providing more details about the Error