Package com.lucimber.dbus.connection
Class AbstractOutboundHandler
java.lang.Object
com.lucimber.dbus.connection.AbstractOutboundHandler
- All Implemented Interfaces:
Handler,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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract org.slf4j.LoggerReturns the logger of the concrete class.voidhandleOutboundMessage(Context ctx, OutboundMessage msg, CompletableFuture<Void> future) Invoked when an outbound message is propagated through the pipeline.voidhandleUserEvent(Context ctx, Object evt) Invoked when a user-defined event is propagated through the pipeline.voidInvoked when the connection associated with this context becomes active.voidInvoked when the connection associated with this context becomes inactive.voidonHandlerAdded(Context ctx) Invoked when this handler is added to the pipeline.voidonHandlerRemoved(Context ctx) Invoked just before this handler is removed from the pipeline.
-
Constructor Details
-
AbstractOutboundHandler
public AbstractOutboundHandler()
-
-
Method Details
-
handleOutboundMessage
Description copied from interface:OutboundHandlerInvoked when an outbound message is propagated through the pipeline.This method is responsible for handling or forwarding the outbound
OutboundMessage. Completion of the providedCompletableFuturesignals the success or failure of the operation.- Specified by:
handleOutboundMessagein interfaceOutboundHandler- Parameters:
ctx- theContextthis 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
Description copied from interface:HandlerInvoked 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:
handleUserEventin interfaceHandler- Parameters:
ctx- theContextthis handler is bound to.evt- the user-defined event to handle.
-
onConnectionActive
Description copied from interface:HandlerInvoked when the connection associated with this context becomes active.- Specified by:
onConnectionActivein interfaceHandler- Parameters:
ctx- theContextthis handler is bound to.
-
onConnectionInactive
Description copied from interface:HandlerInvoked when the connection associated with this context becomes inactive.- Specified by:
onConnectionInactivein interfaceHandler- Parameters:
ctx- theContextthis handler is bound to.
-
onHandlerAdded
Description copied from interface:HandlerInvoked when this handler is added to the pipeline.This is typically the first lifecycle method called for a handler.
- Specified by:
onHandlerAddedin interfaceHandler- Parameters:
ctx- theContextthis handler is bound to.
-
onHandlerRemoved
Description copied from interface:HandlerInvoked just before this handler is removed from the pipeline.This allows the handler to perform any necessary cleanup.
- Specified by:
onHandlerRemovedin interfaceHandler- Parameters:
ctx- theContextthis handler is bound to.
-
getLogger
protected abstract org.slf4j.Logger getLogger()Returns the logger of the concrete class.- Returns:
- the logger
-