Interface Handler

All Known Subinterfaces:
InboundHandler, OutboundHandler
All Known Implementing Classes:
AbstractDuplexHandler, AbstractInboundHandler, AbstractOutboundHandler, ConnectionHealthHandler, ConnectionReconnectHandler, StandardInterfaceHandler

public interface Handler
A handler that can be attached to a Pipeline to intercept and respond to connection state changes and user-defined events.

Implementations of this interface are notified about lifecycle events and can perform processing based on their role in the pipeline.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Invoked when a user-defined event is propagated through the pipeline.
    void
    Invoked when the connection associated with this context becomes active.
    void
    Invoked when the connection associated with this context becomes inactive.
    void
    Invoked when this handler is added to the pipeline.
    void
    Invoked just before this handler is removed from the pipeline.
  • Method Details

    • onConnectionActive

      void onConnectionActive(Context ctx)
      Invoked when the connection associated with this context becomes active.
      Parameters:
      ctx - the Context this handler is bound to.
    • onConnectionInactive

      void onConnectionInactive(Context ctx)
      Invoked when the connection associated with this context becomes inactive.
      Parameters:
      ctx - the Context this handler is bound to.
    • onHandlerAdded

      void onHandlerAdded(Context ctx)
      Invoked when this handler is added to the pipeline.

      This is typically the first lifecycle method called for a handler.

      Parameters:
      ctx - the Context this handler is bound to.
    • onHandlerRemoved

      void onHandlerRemoved(Context ctx)
      Invoked just before this handler is removed from the pipeline.

      This allows the handler to perform any necessary cleanup.

      Parameters:
      ctx - the Context this handler is bound to.
    • handleUserEvent

      void handleUserEvent(Context ctx, Object evt)
      Invoked when a user-defined event is propagated through the pipeline.

      Handlers can choose to react to or forward the event, depending on their logic.

      Parameters:
      ctx - the Context this handler is bound to.
      evt - the user-defined event to handle.