Class OutgoingAMQPEnvelope

java.lang.Object
org.apache.qpid.protonj2.engine.PerformativeEnvelope<Performative>
org.apache.qpid.protonj2.engine.OutgoingAMQPEnvelope

public class OutgoingAMQPEnvelope extends PerformativeEnvelope<Performative>
Frame object that carries an AMQP Performative
  • Field Details

    • AMQP_FRAME_TYPE

      public static final byte AMQP_FRAME_TYPE
      The frame type value to used when encoding the outgoing AMQP frame.
      See Also:
  • Method Details

    • setPayloadToLargeHandler

      public OutgoingAMQPEnvelope setPayloadToLargeHandler(Consumer<Performative> payloadToLargeHandler)
      Configures a handler to be invoked if the payload that is being transmitted with this performative is to large to allow encoding the frame within the maximum configured AMQP frame size limit.
      Parameters:
      payloadToLargeHandler - Handler that will update the Performative to reflect that more than one frame is required.
      Returns:
      this OutgoingAMQPEnvelope instance.
    • handlePayloadToLarge

      public OutgoingAMQPEnvelope handlePayloadToLarge()
      Called when the encoder determines that the encoding of the Performative plus any payload value is to large for a single AMQP frame. The configured handler should update the Performative in preparation for encoding as a split framed AMQP transfer.
      Returns:
      this OutgoingAMQPEnvelope instance
    • setFrameWriteCompletionHandler

      public OutgoingAMQPEnvelope setFrameWriteCompletionHandler(Runnable frameWriteCompleteHandler)
      Configures a handler to be invoked when a write operation that was handed off to the I/O layer has completed indicated that a single frame portion of the payload has been fully written.
      Parameters:
      frameWriteCompleteHandler - Runnable handler that will update state or otherwise respond to the write of a frame.
      Returns:
      this OutgoingAMQPEnvelope instance.
    • handleOutgoingFrameWriteComplete

      public OutgoingAMQPEnvelope handleOutgoingFrameWriteComplete()
      Called by the encoder when the write of a frame that comprises the transfer of the AMQP Performative plus any assigned payload has completed. If the transfer comprises multiple frame writes this handler should be invoked as each frame is successfully written by the IO layer.
      Returns:
      this OutgoingAMQPEnvelope instance.
    • release

      public final void release()
      Used to release a Frame that was taken from a Frame pool in order to make it available for the next input operations. Once called the contents of the Frame are invalid and cannot be used again inside the same context.
    • invoke

      public <E> void invoke(Performative.PerformativeHandler<E> handler, E context)
      Invoke the correct PerformativeHandler event based on the body of this OutgoingAMQPEnvelope
      Type Parameters:
      E - The type that the Performative handler expects for the context value.
      Parameters:
      handler - The handler that should be used to process the current body value.
      context - The context that should be passed along for the current event.