Class AbstractOutboundHandler

java.lang.Object
com.lucimber.dbus.connection.AbstractOutboundHandler
All Implemented Interfaces:
Handler, OutboundHandler

public abstract class AbstractOutboundHandler extends Object implements OutboundHandler
A skeletal implementation of the OutboundHandler interface.

This abstract base class provides default (no-op) implementations of all lifecycle methods except for the core outbound handling method, which must be implemented by subclasses.

Extend this class to simplify the creation of handlers that only need to process outbound messages and optionally react to connection or pipeline events.

See Also:
  • Constructor Details

    • AbstractOutboundHandler

      public AbstractOutboundHandler()
  • Method Details

    • handleOutboundMessage

      public void handleOutboundMessage(Context ctx, OutboundMessage msg, CompletableFuture<Void> future)
      Description copied from interface: OutboundHandler
      Invoked when an outbound message is propagated through the pipeline.

      This method is responsible for handling or forwarding the outbound OutboundMessage. Completion of the provided CompletableFuture signals the success or failure of the operation.

      Specified by:
      handleOutboundMessage in interface OutboundHandler
      Parameters:
      ctx - the Context this handler is bound to.
      msg - the outbound message to process.
      future - the future to complete once the message has been handled or an error has occurred.
    • handleUserEvent

      public void handleUserEvent(Context ctx, Object evt)
      Description copied from interface: Handler
      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.

      Specified by:
      handleUserEvent in interface Handler
      Parameters:
      ctx - the Context this handler is bound to.
      evt - the user-defined event to handle.
    • onConnectionActive

      public void onConnectionActive(Context ctx)
      Description copied from interface: Handler
      Invoked when the connection associated with this context becomes active.
      Specified by:
      onConnectionActive in interface Handler
      Parameters:
      ctx - the Context this handler is bound to.
    • onConnectionInactive

      public void onConnectionInactive(Context ctx)
      Description copied from interface: Handler
      Invoked when the connection associated with this context becomes inactive.
      Specified by:
      onConnectionInactive in interface Handler
      Parameters:
      ctx - the Context this handler is bound to.
    • onHandlerAdded

      public void onHandlerAdded(Context ctx)
      Description copied from interface: Handler
      Invoked when this handler is added to the pipeline.

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

      Specified by:
      onHandlerAdded in interface Handler
      Parameters:
      ctx - the Context this handler is bound to.
    • onHandlerRemoved

      public void onHandlerRemoved(Context ctx)
      Description copied from interface: Handler
      Invoked just before this handler is removed from the pipeline.

      This allows the handler to perform any necessary cleanup.

      Specified by:
      onHandlerRemoved in interface Handler
      Parameters:
      ctx - the Context this handler is bound to.
    • getLogger

      protected abstract org.slf4j.Logger getLogger()
      Returns the logger of the concrete class.
      Returns:
      the logger