public class MessageHandlerRegistrar extends Object
MessageHandlerRegistrar
manages the lifecycle of a message handling component, by defining a start()
and shutdown()
method and keeping hold of the message handler's Registration
.
Note that this component is not intended for Event Handling Components, as those should be registered through the
EventProcessingConfigurer
.
Constructor and Description |
---|
MessageHandlerRegistrar(Supplier<Configuration> configSupplier,
Function<Configuration,Object> messageHandlerBuilder,
BiFunction<Configuration,Object,Registration> messageHandlerSubscriber)
Instantiate a
MessageHandlerRegistrar , using the provided configSupplier to supply the Configuration needed to build and register the message handler. |
Modifier and Type | Method and Description |
---|---|
void |
shutdown()
Close the message handler registration initialized in phase
Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS
through the start() method. |
void |
start()
Start the message handler registration process by building the message handler in the
Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS phase. |
public MessageHandlerRegistrar(Supplier<Configuration> configSupplier, Function<Configuration,Object> messageHandlerBuilder, BiFunction<Configuration,Object,Registration> messageHandlerSubscriber)
MessageHandlerRegistrar
, using the provided configSupplier
to supply the Configuration
needed to build and register the message handler. For the latter operations the given messageHandlerBuilder
and messageHandlerSubscriber
will be used respectively.configSupplier
- a Supplier
of the Configuration
to be used by the given messageHandlerBuilder
and messageHandlerSubscriber
messageHandlerBuilder
- a Function
using the configSupplier
's input to create a message
handlermessageHandlerSubscriber
- a BiFunction
using the the configSupplier
and messageHandlerBuilder
their output to register the created message handler with
the Configuration
@StartHandler(phase=0) public void start()
Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS
phase. The specified messageHandlerBuilder
is used for
creation and registration is performed through the messageHandlerSubscriber
.@ShutdownHandler(phase=0) public void shutdown()
Phase.LOCAL_MESSAGE_HANDLER_REGISTRATIONS
through the start()
method.Copyright © 2010–2022. All rights reserved.