Package org.axonframework.config
Class MessageHandlerRegistrar
java.lang.Object
org.axonframework.config.MessageHandlerRegistrar
- All Implemented Interfaces:
Lifecycle
The
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.
- Since:
- 4.3
- Author:
- Steven van Beelen
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.axonframework.lifecycle.Lifecycle
Lifecycle.LifecycleHandler, Lifecycle.LifecycleRegistry -
Constructor Summary
ConstructorsConstructorDescriptionMessageHandlerRegistrar(Supplier<Configuration> configSupplier, Function<Configuration, Object> messageHandlerBuilder, BiFunction<Configuration, Object, Registration> messageHandlerSubscriber) Instantiate aMessageHandlerRegistrar, using the providedconfigSupplierto supply theConfigurationneeded to build and register the message handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters the activities to be executed in the various phases of an application's lifecycle.voidshutdown()Close the message handler registration initialized in phasePhase.LOCAL_MESSAGE_HANDLER_REGISTRATIONSthrough thestart()method.voidstart()Start the message handler registration process by building the message handler in thePhase.LOCAL_MESSAGE_HANDLER_REGISTRATIONSphase.
-
Constructor Details
-
MessageHandlerRegistrar
public MessageHandlerRegistrar(Supplier<Configuration> configSupplier, Function<Configuration, Object> messageHandlerBuilder, BiFunction<Configuration, Object, Registration> messageHandlerSubscriber) Instantiate aMessageHandlerRegistrar, using the providedconfigSupplierto supply theConfigurationneeded to build and register the message handler. For the latter operations the givenmessageHandlerBuilderandmessageHandlerSubscriberwill be used respectively.- Parameters:
configSupplier- aSupplierof theConfigurationto be used by the givenmessageHandlerBuilderandmessageHandlerSubscribermessageHandlerBuilder- aFunctionusing theconfigSupplier's input to create a message handlermessageHandlerSubscriber- aBiFunctionusing the theconfigSupplierandmessageHandlerBuildertheir output to register the created message handler with theConfiguration
-
-
Method Details
-
registerLifecycleHandlers
Description copied from interface:LifecycleRegisters the activities to be executed in the various phases of an application's lifecycle. This could either be at startup, shutdown, or both.- Specified by:
registerLifecycleHandlersin interfaceLifecycle- Parameters:
handle- the lifecycle instance to register the handlers with- See Also:
-
start
public void start()Start the message handler registration process by building the message handler in thePhase.LOCAL_MESSAGE_HANDLER_REGISTRATIONSphase. The specifiedmessageHandlerBuilderis used for creation and registration is performed through themessageHandlerSubscriber. -
shutdown
public void shutdown()Close the message handler registration initialized in phasePhase.LOCAL_MESSAGE_HANDLER_REGISTRATIONSthrough thestart()method.
-