Class AbstractInboundHandler

java.lang.Object
com.lucimber.dbus.connection.AbstractInboundHandler
All Implemented Interfaces:
Handler, InboundHandler
Direct Known Subclasses:
StandardInterfaceHandler

public abstract class AbstractInboundHandler extends Object implements InboundHandler
A skeletal implementation of the InboundHandler interface.

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

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

The default implementations of all methods simply propagate events through the pipeline without any additional processing, making this class suitable as a base for handlers that only need to override specific methods.

Since:
1.0.0
See Also:
  • Constructor Details

    • AbstractInboundHandler

      public AbstractInboundHandler()
  • Method Details

    • handleInboundFailure

      public void handleInboundFailure(Context ctx, Throwable cause)
      Default implementation that simply propagates the failure through the pipeline.
      Specified by:
      handleInboundFailure in interface InboundHandler
      Parameters:
      ctx - the Context this handler is bound to
      cause - the Throwable describing the failure
      Since:
      1.0.0
    • handleInboundMessage

      public void handleInboundMessage(Context ctx, InboundMessage msg)
      Default implementation that simply propagates the message through the pipeline.
      Specified by:
      handleInboundMessage in interface InboundHandler
      Parameters:
      ctx - the Context this handler is bound to
      msg - the InboundMessage being processed
      Since:
      1.0.0
    • handleUserEvent

      public void handleUserEvent(Context ctx, Object evt)
      Default implementation that simply propagates the user event through the pipeline.
      Specified by:
      handleUserEvent in interface Handler
      Parameters:
      ctx - the Context this handler is bound to
      evt - the user-defined event object
      Since:
      1.0.0
    • onConnectionActive

      public void onConnectionActive(Context ctx)
      Default implementation that simply propagates the connection active event through the pipeline.
      Specified by:
      onConnectionActive in interface Handler
      Parameters:
      ctx - the Context this handler is bound to
      Since:
      1.0.0
    • onConnectionInactive

      public void onConnectionInactive(Context ctx)
      Default implementation that simply propagates the connection inactive event through the pipeline.
      Specified by:
      onConnectionInactive in interface Handler
      Parameters:
      ctx - the Context this handler is bound to
      Since:
      1.0.0
    • onHandlerAdded

      public void onHandlerAdded(Context ctx)
      Default implementation that logs the handler addition event.
      Specified by:
      onHandlerAdded in interface Handler
      Parameters:
      ctx - the Context this handler is bound to
      Since:
      1.0.0
    • onHandlerRemoved

      public void onHandlerRemoved(Context ctx)
      Default implementation that logs the handler removal event.
      Specified by:
      onHandlerRemoved in interface Handler
      Parameters:
      ctx - the Context this handler is bound to
      Since:
      1.0.0
    • getLogger

      protected abstract org.slf4j.Logger getLogger()
      Returns the logger of the concrete class.
      Returns:
      the logger instance for this handler
      Since:
      1.0.0