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.Logger
Returns the logger of the concrete class.void
handleOutboundMessage
(Context ctx, OutboundMessage msg, CompletableFuture<Void> future) Invoked when an outbound message is propagated through the pipeline.void
handleUserEvent
(Context ctx, Object evt) 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
onHandlerAdded
(Context ctx) Invoked when this handler is added to the pipeline.void
onHandlerRemoved
(Context ctx) Invoked just before this handler is removed from the pipeline.
-
Constructor Details
-
AbstractOutboundHandler
public AbstractOutboundHandler()
-
-
Method Details
-
handleOutboundMessage
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 providedCompletableFuture
signals the success or failure of the operation.- Specified by:
handleOutboundMessage
in interfaceOutboundHandler
- Parameters:
ctx
- theContext
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
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 interfaceHandler
- Parameters:
ctx
- theContext
this handler is bound to.evt
- the user-defined event to handle.
-
onConnectionActive
Description copied from interface:Handler
Invoked when the connection associated with this context becomes active.- Specified by:
onConnectionActive
in interfaceHandler
- Parameters:
ctx
- theContext
this handler is bound to.
-
onConnectionInactive
Description copied from interface:Handler
Invoked when the connection associated with this context becomes inactive.- Specified by:
onConnectionInactive
in interfaceHandler
- Parameters:
ctx
- theContext
this handler is bound to.
-
onHandlerAdded
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 interfaceHandler
- Parameters:
ctx
- theContext
this handler is bound to.
-
onHandlerRemoved
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 interfaceHandler
- Parameters:
ctx
- theContext
this handler is bound to.
-
getLogger
protected abstract org.slf4j.Logger getLogger()Returns the logger of the concrete class.- Returns:
- the logger
-