Package org.apache.qpid.protonj2.engine
Interface EngineHandler
- All Known Implementing Classes:
- ProtonFrameDecodingHandler,- ProtonFrameEncodingHandler,- ProtonFrameLoggingHandler,- ProtonPerformativeHandler,- ProtonSaslHandler
public interface EngineHandler
Listen for events generated from the Engine
- 
Method SummaryModifier and TypeMethodDescriptiondefault voidengineFailed(EngineHandlerContext context, EngineFailedException failure) Called when the engine has transitioned to a failed state and cannot process any additional input or output.default voidengineStarting(EngineHandlerContext context) Called when the engine is started to allow handlers to prepare for use based on the configuration state at start of the engine.default voidCalled when the engine state has changed and handlers may need to update their internal state to respond to the change or prompt some new work based on the change, e.g state changes from not writable to writable.default voidhandlerAdded(EngineHandlerContext context) Called when the handler is successfully added to theEnginePipelineand will later be initialized before use.default voidhandleRead(EngineHandlerContext context, ProtonBuffer buffer) Handle the read of new incoming bytes from a remote sender.default voidhandleRead(EngineHandlerContext context, HeaderEnvelope header) Handle the receipt of an incoming AMQP Header or SASL Header based on the current state of this handler.default voidhandleRead(EngineHandlerContext context, IncomingAMQPEnvelope envelope) Handle the receipt of an incoming AMQP envelope based on the current state of this handler.default voidhandleRead(EngineHandlerContext context, SASLEnvelope envelope) Handle the receipt of an incoming SASL performative based on the current state of this handler.default voidhandlerRemoved(EngineHandlerContext context) Called when the handler is successfully removed to theEnginePipeline.default voidhandleWrite(EngineHandlerContext context, ProtonBuffer buffer, Runnable ioComplete) Writes the given bytes to the output target or if no handler in the pipeline handles this calls the registered output handler of the parent Engine instance.default voidhandleWrite(EngineHandlerContext context, HeaderEnvelope envelope) Handles write of AMQPHeader either by directly writing it to the output target or by converting it to bytes and firing a write using theProtonBufferbased API inEngineHandlerContext.fireWrite(ProtonBuffer, Runnable)default voidhandleWrite(EngineHandlerContext context, OutgoingAMQPEnvelope envelope) Handles write of AMQP performative envelope either by directly writing it to the output target or by converting it to bytes and firing a write using theProtonBufferbased API inEngineHandlerContext.fireWrite(ProtonBuffer, Runnable)default voidhandleWrite(EngineHandlerContext context, SASLEnvelope envelope) Handles write of SaslPerformative either by directly writing it to the output target or by converting it to bytes and firing a write using theProtonBufferbased API inEngineHandlerContext.fireWrite(ProtonBuffer, Runnable)
- 
Method Details- 
handlerAddedCalled when the handler is successfully added to theEnginePipelineand will later be initialized before use.- Parameters:
- context- The context that is assigned to this handler.
 
- 
handlerRemovedCalled when the handler is successfully removed to theEnginePipeline.- Parameters:
- context- The context that is assigned to this handler.
 
- 
engineStartingCalled when the engine is started to allow handlers to prepare for use based on the configuration state at start of the engine. A handler can fail the engine start by throwing an exception.- Parameters:
- context- The context for this handler which can be used to forward the event to the next handler
 
- 
handleEngineStateChangedCalled when the engine state has changed and handlers may need to update their internal state to respond to the change or prompt some new work based on the change, e.g state changes from not writable to writable.- Parameters:
- context- The context for this handler which can be used to forward the event to the next handler
 
- 
engineFailedCalled when the engine has transitioned to a failed state and cannot process any additional input or output. The handler can free and resources used for normal operations at this point as the engine is now considered shutdown.- Parameters:
- context- The context for this handler which can be used to forward the event to the next handler
- failure- The failure that triggered the engine to cease operations.
 
- 
handleReadHandle the read of new incoming bytes from a remote sender. The handler should generally decode these bytes into an AMQP Performative or SASL Performative based on the current state of the connection and the handler in question.- Parameters:
- context- The context for this handler which can be used to forward the event to the next handler
- buffer- The buffer containing the bytes that the engine handler should decode.
 
- 
handleReadHandle the receipt of an incoming AMQP Header or SASL Header based on the current state of this handler.- Parameters:
- context- The context for this handler which can be used to forward the event to the next handler
- header- The AMQP Header envelope that wraps the received header instance.
 
- 
handleReadHandle the receipt of an incoming SASL performative based on the current state of this handler.- Parameters:
- context- The context for this handler which can be used to forward the event to the next handler
- envelope- The SASL envelope that wraps the received- SaslPerformative.
 
- 
handleReadHandle the receipt of an incoming AMQP envelope based on the current state of this handler.- Parameters:
- context- The context for this handler which can be used to forward the event to the next handler
- envelope- The AMQP envelope that wraps the received- Performative.
 
- 
handleWriteHandles write of AMQPHeader either by directly writing it to the output target or by converting it to bytes and firing a write using theProtonBufferbased API inEngineHandlerContext.fireWrite(ProtonBuffer, Runnable)- Parameters:
- context- The- EngineHandlerContextassociated with this- EngineHandlerinstance.
- envelope- The- HeaderEnvelopeinstance to write.
 
- 
handleWriteHandles write of AMQP performative envelope either by directly writing it to the output target or by converting it to bytes and firing a write using theProtonBufferbased API inEngineHandlerContext.fireWrite(ProtonBuffer, Runnable)- Parameters:
- context- The- EngineHandlerContextassociated with this- EngineHandlerinstance.
- envelope- The- OutgoingAMQPEnvelopeinstance to write.
 
- 
handleWriteHandles write of SaslPerformative either by directly writing it to the output target or by converting it to bytes and firing a write using theProtonBufferbased API inEngineHandlerContext.fireWrite(ProtonBuffer, Runnable)- Parameters:
- context- The- EngineHandlerContextassociated with this- EngineHandlerinstance.
- envelope- The- SASLEnvelopeinstance to write.
 
- 
handleWriteWrites the given bytes to the output target or if no handler in the pipeline handles this calls the registered output handler of the parent Engine instance. If not output handler is found or not handler in the output chain consumes this write the Engine will be failed as an output sink is required for all low level engine writes.- Parameters:
- context- The- EngineHandlerContextassociated with this- EngineHandlerinstance.
- buffer- The- ProtonBufferwhose payload is to be written to the output target.
- ioComplete- A- Runnablecallback that indicates that the I/O operation is complete
 
 
-