Interface EngineHandler

    • Method Detail

      • handlerAdded

        default void handlerAdded​(EngineHandlerContext context)
        Called when the handler is successfully added to the EnginePipeline and will later be initialized before use.
        Parameters:
        context - The context that is assigned to this handler.
      • handlerRemoved

        default void handlerRemoved​(EngineHandlerContext context)
        Called when the handler is successfully removed to the EnginePipeline.
        Parameters:
        context - The context that is assigned to this handler.
      • engineStarting

        default void engineStarting​(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. 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
      • handleEngineStateChanged

        default void handleEngineStateChanged​(EngineHandlerContext context)
        Called 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
      • engineFailed

        default void engineFailed​(EngineHandlerContext context,
                                  EngineFailedException failure)
        Called 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.
      • handleRead

        default void handleRead​(EngineHandlerContext context,
                                ProtonBuffer buffer)
        Handle 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.
      • handleRead

        default void handleRead​(EngineHandlerContext context,
                                HeaderEnvelope header)
        Handle 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.
      • handleRead

        default void handleRead​(EngineHandlerContext context,
                                SASLEnvelope envelope)
        Handle 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.
      • handleRead

        default void handleRead​(EngineHandlerContext context,
                                IncomingAMQPEnvelope envelope)
        Handle 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.
      • handleWrite

        default void handleWrite​(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. 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 EngineHandlerContext associated with this EngineHandler instance.
        buffer - The ProtonBuffer whose payload is to be written to the output target.
        ioComplete - A Runnable callback that indicates that the I/O operation is complete