Package org.apache.qpid.protonj2.engine
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 Summary
Fields Modifier and Type Field Description static byte
AMQP_FRAME_TYPE
The frame type value to used when encoding the outgoing AMQP frame.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OutgoingAMQPEnvelope
handleOutgoingFrameWriteComplete()
Called by the encoder when the write of a frame that comprises the transfer of the AMQPPerformative
plus any assigned payload has completed.OutgoingAMQPEnvelope
handlePayloadToLarge()
Called when the encoder determines that the encoding of thePerformative
plus any payload value is to large for a single AMQP frame.<E> void
invoke(Performative.PerformativeHandler<E> handler, E context)
Invoke the correct PerformativeHandler event based on the body of thisOutgoingAMQPEnvelope
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.OutgoingAMQPEnvelope
setFrameWriteCompletionHandler(java.lang.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.OutgoingAMQPEnvelope
setPayloadToLargeHandler(java.util.function.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.-
Methods inherited from class org.apache.qpid.protonj2.engine.PerformativeEnvelope
getBody, getChannel, getFrameType, getPayload, toString
-
-
-
-
Field Detail
-
AMQP_FRAME_TYPE
public static final byte AMQP_FRAME_TYPE
The frame type value to used when encoding the outgoing AMQP frame.- See Also:
- Constant Field Values
-
-
Method Detail
-
setPayloadToLargeHandler
public OutgoingAMQPEnvelope setPayloadToLargeHandler(java.util.function.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 thePerformative
plus any payload value is to large for a single AMQP frame. The configured handler should update thePerformative
in preparation for encoding as a split framed AMQP transfer.- Returns:
- this
OutgoingAMQPEnvelope
instance
-
setFrameWriteCompletionHandler
public OutgoingAMQPEnvelope setFrameWriteCompletionHandler(java.lang.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 AMQPPerformative
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 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 thisOutgoingAMQPEnvelope
- Type Parameters:
E
- The type that thePerformative
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.
-
-