Class EventSourcingConfigurer
- All Implemented Interfaces:
ApplicationConfigurer
ApplicationConfigurer of Axon Framework's configuration API.
Provides register operations for registerEventStorageEngine(ComponentBuilder) the event storage engine} and
event store infrastructure components.
This configurer registers the following defaults:
- Registers a
AnnotationBasedTagResolverfor classTagResolver - Registers a
InMemoryEventStorageEnginefor classEventStorageEngine - Registers a
StorageEngineBackedEventStorefor classEventStore - Registers a
StorageEngineBackedEventStorefor classEventSink
EventStore, do
configurer.componentRegistry(cr ->
cr.registerComponent(EventStore.class, c -> new CustomEventStore()))
to replace it.- Since:
- 5.0.0
- Author:
- Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns the completely initializedConfigurationinstance of typeCbuilt using thisConfigurerimplementation.componentRegistry(Consumer<ComponentRegistry> componentRegistrar) Executes the givencomponentRegistraron the component registry associated with thisApplicationConfigurer.static EventSourcingConfigurercreate()Build a defaultEventSourcingConfigurerinstance with several event sourcing defaults.static EventSourcingConfigurerenhance(ModellingConfigurer modellingConfigurer) Creates a EventSourcingConfigurer that enhances an existingModellingConfigurer.lifecycleRegistry(Consumer<LifecycleRegistry> lifecycleRegistrar) Executes the givenlifecycleRegistraron the lifecycle registry associated with thisApplicationConfigurer.messaging(Consumer<MessagingConfigurer> configurerTask) Delegates the givenconfigurerTaskto theMessagingConfigurerthisEventSourcingConfigurerdelegates.modelling(Consumer<ModellingConfigurer> configurerTask) Delegates the givenconfigurerTaskto theModellingConfigurerthisEventSourcingConfigurerdelegates.registerCommandHandlingModule(ModuleBuilder<CommandHandlingModule> moduleBuilder) Registers the given command handlingmoduleBuilderto use in this configuration.<I,E> EventSourcingConfigurer registerEntity(EntityModule<I, E> entityModule) Registers the givenentityModuleon the root-levelConfiguration.registerEventStorageEngine(ComponentBuilder<EventStorageEngine> eventStorageEngineFactory) Registers the givenEventStorageEnginefactory in thisConfigurer.registerEventStore(ComponentBuilder<EventStore> eventStoreFactory) Registers the givenEventStorefactory in thisConfigurer.registerQueryHandlingModule(ModuleBuilder<QueryHandlingModule> moduleBuilder) Registers the given query handlingmoduleBuilderto use in this configuration.registerTagResolver(ComponentBuilder<TagResolver> tagResolverFactory) Registers the givenTagResolverfactory in thisConfigurer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.common.configuration.ApplicationConfigurer
start
-
Method Details
-
create
Build a defaultEventSourcingConfigurerinstance with several event sourcing defaults.Besides the specific operations, the
EventSourcingConfigurerallows for configuring genericcomponents,component decorators,enhancers, andmodulesfor an event-sourced application.Note that this configurer uses a
ModellingConfigurerto support event-sourced entities.- Returns:
- A
EventSourcingConfigurerinstance for further configuring.
-
enhance
Creates a EventSourcingConfigurer that enhances an existingModellingConfigurer. This method is useful when applying multiple specialized Configurers to configure a single application.- Parameters:
modellingConfigurer- TheModellingConfigurerto enhance with configuration of modelling components.- Returns:
- The current instance of the
Configurerfor a fluent API. - See Also:
-
registerCommandHandlingModule
public EventSourcingConfigurer registerCommandHandlingModule(ModuleBuilder<CommandHandlingModule> moduleBuilder) Registers the given command handlingmoduleBuilderto use in this configuration.As a
Moduleimplementation, any components registered with the result of the givenmoduleBuilderwill not be accessible from otherModulesto enforce encapsulation.- Parameters:
moduleBuilder- The builder returning a command handling module to register withthis EventSourcingConfigurer.- Returns:
- A
EventSourcingConfigurerinstance for further configuring.
-
registerQueryHandlingModule
public EventSourcingConfigurer registerQueryHandlingModule(ModuleBuilder<QueryHandlingModule> moduleBuilder) Registers the given query handlingmoduleBuilderto use in this configuration.As a
Moduleimplementation, any components registered with the result of the givenmoduleBuilderwill not be accessible from otherModulesto enforce encapsulation.- Parameters:
moduleBuilder- The builder returning a query handling module to register withthis EventSourcingConfigurer.- Returns:
- A
EventSourcingConfigurerinstance for further configuring.
-
registerEntity
@Nonnull public <I,E> EventSourcingConfigurer registerEntity(@Nonnull EntityModule<I, E> entityModule) Registers the givenentityModuleon the root-levelConfiguration. This will make the entity available in the globally availableStateManager.- Type Parameters:
I- The type of identifier used to identify the entity that's being built.E- The type of the entity being built.- Parameters:
entityModule- The entity module to register.- Returns:
- A
EventSourcingConfigurerinstance for further configuring.
-
registerTagResolver
public EventSourcingConfigurer registerTagResolver(@Nonnull ComponentBuilder<TagResolver> tagResolverFactory) Registers the givenTagResolverfactory in thisConfigurer.The
eventStorageEngineFactoryreceives theConfigurationas input and is expected to return aTagResolverinstance.- Parameters:
tagResolverFactory- The factory building theTagResolver.- Returns:
- The current instance of the
Configurerfor a fluent API.
-
registerEventStorageEngine
public EventSourcingConfigurer registerEventStorageEngine(@Nonnull ComponentBuilder<EventStorageEngine> eventStorageEngineFactory) Registers the givenEventStorageEnginefactory in thisConfigurer.The
eventStorageEngineFactoryreceives theConfigurationas input and is expected to return aEventStorageEngineinstance.- Parameters:
eventStorageEngineFactory- The factory building theEventStorageEngine.- Returns:
- The current instance of the
Configurerfor a fluent API.
-
registerEventStore
public EventSourcingConfigurer registerEventStore(@Nonnull ComponentBuilder<EventStore> eventStoreFactory) Registers the givenEventStorefactory in thisConfigurer.The
eventStoreFactoryreceives theConfigurationas input and is expected to return aEventStoreinstance.- Parameters:
eventStoreFactory- The factory building theEventStore.- Returns:
- The current instance of the
Configurerfor a fluent API.
-
modelling
Delegates the givenconfigurerTaskto theModellingConfigurerthisEventSourcingConfigurerdelegates.Use this operation to invoke registration methods that only exist on the
ModellingConfigurer.- Parameters:
configurerTask- Lambda consuming the delegateModellingConfigurer.- Returns:
- The current instance of the
Configurerfor a fluent API.
-
messaging
Delegates the givenconfigurerTaskto theMessagingConfigurerthisEventSourcingConfigurerdelegates.Use this operation to invoke registration methods that only exist on the
MessagingConfigurer.- Parameters:
configurerTask- Lambda consuming the delegateMessagingConfigurer.- Returns:
- The current instance of the
Configurerfor a fluent API.
-
componentRegistry
public EventSourcingConfigurer componentRegistry(@Nonnull Consumer<ComponentRegistry> componentRegistrar) Description copied from interface:ApplicationConfigurerExecutes the givencomponentRegistraron the component registry associated with thisApplicationConfigurer.- Specified by:
componentRegistryin interfaceApplicationConfigurer- Parameters:
componentRegistrar- The actions to take on the component registry.- Returns:
- This
ApplicationConfigurerfor a fluent API.
-
lifecycleRegistry
public EventSourcingConfigurer lifecycleRegistry(@Nonnull Consumer<LifecycleRegistry> lifecycleRegistrar) Description copied from interface:ApplicationConfigurerExecutes the givenlifecycleRegistraron the lifecycle registry associated with thisApplicationConfigurer.- Specified by:
lifecycleRegistryin interfaceApplicationConfigurer- Parameters:
lifecycleRegistrar- The actions to take on the lifecycle registry.- Returns:
- This
ApplicationConfigurerfor a fluent API.
-
build
Description copied from interface:ApplicationConfigurerReturns the completely initializedConfigurationinstance of typeCbuilt using thisConfigurerimplementation.It is not recommended to change any configuration on
this ApplicationConfigureronce this method is called.- Specified by:
buildin interfaceApplicationConfigurer- Returns:
- The fully initialized
Configurationinstance of typeC.
-