Class HandlerRegistry.MergedHandlerRegistry
java.lang.Object
io.fluxzero.sdk.tracking.handling.HandlerRegistry.MergedHandlerRegistry
- All Implemented Interfaces:
HandlerRegistry, HasLocalHandlers
- Enclosing interface:
HandlerRegistry
Combines two
HandlerRegistry instances into one.
Useful for layering or composing registries programmatically.
-
Nested Class Summary
Nested classes/interfaces inherited from interface HandlerRegistry
HandlerRegistry.MergedHandlerRegistry, HandlerRegistry.NoOpHandlerRegistry -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhandle(DeserializingMessage message) Attempts to handle the given message using local handlers.booleanIndicates whether any local handlers are currently registered for this gateway.io.fluxzero.common.RegistrationregisterHandler(Object target) Registers the given handler object and includes only the methods that are annotated with a recognized handler annotation (e.g.,@HandleCommand,@HandleQuery, etc.).io.fluxzero.common.RegistrationregisterHandler(Object target, io.fluxzero.common.handling.HandlerFilter handlerFilter) Registers a handler object, including only those methods that match the providedHandlerFilter.voidsetSelfHandlerFilter(io.fluxzero.common.handling.HandlerFilter selfHandlerFilter) Sets a custom filter to control whether a handler method is considered a local handler for the current application.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HandlerRegistry
andThen, orThen
-
Field Details
-
first
-
second
-
-
Constructor Details
-
MergedHandlerRegistry
public MergedHandlerRegistry()
-
-
Method Details
-
handle
Description copied from interface:HandlerRegistryAttempts to handle the given message using local handlers.- Specified by:
handlein interfaceHandlerRegistry- Parameters:
message- the deserialized message to dispatch- Returns:
- an optional future containing the result, or empty if no handler was found
-
registerHandler
Description copied from interface:HasLocalHandlersRegisters the given handler object and includes only the methods that are annotated with a recognized handler annotation (e.g.,@HandleCommand,@HandleQuery, etc.).This method uses
LocalHandlerto determine which methods to include. If a payload has an annotated handler likeHandleQueryinside its class and the class is not annotated withTrackSelf, the handler is also considered to be local.- Specified by:
registerHandlerin interfaceHasLocalHandlers- Parameters:
target- the object containing handler methods- Returns:
- a
Registrationwhich can be used to unregister the handlers
-
hasLocalHandlers
public boolean hasLocalHandlers()Description copied from interface:HasLocalHandlersIndicates whether any local handlers are currently registered for this gateway.- Specified by:
hasLocalHandlersin interfaceHasLocalHandlers- Returns:
trueif local handlers are present,falseotherwise
-
setSelfHandlerFilter
public void setSelfHandlerFilter(io.fluxzero.common.handling.HandlerFilter selfHandlerFilter) Description copied from interface:HasLocalHandlersSets a custom filter to control whether a handler method is considered a local handler for the current application. This is typically used internally to ensure that handlers are associated with the correct application or component.- Specified by:
setSelfHandlerFilterin interfaceHasLocalHandlers- Parameters:
selfHandlerFilter- aHandlerFilterto apply to registered handlers
-
registerHandler
public io.fluxzero.common.Registration registerHandler(Object target, io.fluxzero.common.handling.HandlerFilter handlerFilter) Description copied from interface:HasLocalHandlersRegisters a handler object, including only those methods that match the providedHandlerFilter.This method offers fine-grained control over which handler methods are registered, based on custom logic applied to method annotations and/or signatures.
- Specified by:
registerHandlerin interfaceHasLocalHandlers- Parameters:
target- the handler object containing annotated methodshandlerFilter- the filter used to determine which methods should be registered- Returns:
- a
Registrationwhich can be used to unregister the handlers
-