Class EventSourcingConfigurer

java.lang.Object
org.axonframework.eventsourcing.configuration.EventSourcingConfigurer
All Implemented Interfaces:
ApplicationConfigurer

public class EventSourcingConfigurer extends Object implements ApplicationConfigurer
The event sourcing 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:

To replace or decorate any of these defaults, use their respective interfaces as the identifier. For example, to adjust the EventStore, do

     configurer.componentRegistry(cr ->
                  cr.registerComponent(EventStore.class, c -> new CustomEventStore()))
 
to replace it.
Since:
5.0.0
Author:
Steven van Beelen
  • Method Details

    • create

      public static EventSourcingConfigurer create()
      Build a default EventSourcingConfigurer instance with several event sourcing defaults.

      Besides the specific operations, the EventSourcingConfigurer allows for configuring generic components, component decorators, enhancers, and modules for an event-sourced application.

      Note that this configurer uses a ModellingConfigurer to support event-sourced entities.

      Returns:
      A EventSourcingConfigurer instance for further configuring.
    • enhance

      public static EventSourcingConfigurer enhance(@Nonnull ModellingConfigurer modellingConfigurer)
      Creates a EventSourcingConfigurer that enhances an existing ModellingConfigurer. This method is useful when applying multiple specialized Configurers to configure a single application.
      Parameters:
      modellingConfigurer - The ModellingConfigurer to enhance with configuration of modelling components.
      Returns:
      The current instance of the Configurer for a fluent API.
      See Also:
    • registerCommandHandlingModule

      public EventSourcingConfigurer registerCommandHandlingModule(ModuleBuilder<CommandHandlingModule> moduleBuilder)
      Registers the given command handling moduleBuilder to use in this configuration.

      As a Module implementation, any components registered with the result of the given moduleBuilder will not be accessible from other Modules to enforce encapsulation.

      Parameters:
      moduleBuilder - The builder returning a command handling module to register with this EventSourcingConfigurer.
      Returns:
      A EventSourcingConfigurer instance for further configuring.
    • registerQueryHandlingModule

      public EventSourcingConfigurer registerQueryHandlingModule(ModuleBuilder<QueryHandlingModule> moduleBuilder)
      Registers the given query handling moduleBuilder to use in this configuration.

      As a Module implementation, any components registered with the result of the given moduleBuilder will not be accessible from other Modules to enforce encapsulation.

      Parameters:
      moduleBuilder - The builder returning a query handling module to register with this EventSourcingConfigurer.
      Returns:
      A EventSourcingConfigurer instance for further configuring.
    • registerEntity

      @Nonnull public <I, E> EventSourcingConfigurer registerEntity(@Nonnull EntityModule<I,E> entityModule)
      Registers the given entityModule on the root-level Configuration. This will make the entity available in the globally available StateManager.
      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 EventSourcingConfigurer instance for further configuring.
    • registerTagResolver

      public EventSourcingConfigurer registerTagResolver(@Nonnull ComponentBuilder<TagResolver> tagResolverFactory)
      Registers the given TagResolver factory in this Configurer.

      The eventStorageEngineFactory receives the Configuration as input and is expected to return a TagResolver instance.

      Parameters:
      tagResolverFactory - The factory building the TagResolver.
      Returns:
      The current instance of the Configurer for a fluent API.
    • registerEventStorageEngine

      public EventSourcingConfigurer registerEventStorageEngine(@Nonnull ComponentBuilder<EventStorageEngine> eventStorageEngineFactory)
      Registers the given EventStorageEngine factory in this Configurer.

      The eventStorageEngineFactory receives the Configuration as input and is expected to return a EventStorageEngine instance.

      Parameters:
      eventStorageEngineFactory - The factory building the EventStorageEngine.
      Returns:
      The current instance of the Configurer for a fluent API.
    • registerEventStore

      public EventSourcingConfigurer registerEventStore(@Nonnull ComponentBuilder<EventStore> eventStoreFactory)
      Registers the given EventStore factory in this Configurer.

      The eventStoreFactory receives the Configuration as input and is expected to return a EventStore instance.

      Parameters:
      eventStoreFactory - The factory building the EventStore.
      Returns:
      The current instance of the Configurer for a fluent API.
    • modelling

      public EventSourcingConfigurer modelling(@Nonnull Consumer<ModellingConfigurer> configurerTask)
      Delegates the given configurerTask to the ModellingConfigurer this EventSourcingConfigurer delegates.

      Use this operation to invoke registration methods that only exist on the ModellingConfigurer.

      Parameters:
      configurerTask - Lambda consuming the delegate ModellingConfigurer.
      Returns:
      The current instance of the Configurer for a fluent API.
    • messaging

      public EventSourcingConfigurer messaging(@Nonnull Consumer<MessagingConfigurer> configurerTask)
      Delegates the given configurerTask to the MessagingConfigurer this EventSourcingConfigurer delegates.

      Use this operation to invoke registration methods that only exist on the MessagingConfigurer.

      Parameters:
      configurerTask - Lambda consuming the delegate MessagingConfigurer.
      Returns:
      The current instance of the Configurer for a fluent API.
    • componentRegistry

      public EventSourcingConfigurer componentRegistry(@Nonnull Consumer<ComponentRegistry> componentRegistrar)
      Description copied from interface: ApplicationConfigurer
      Executes the given componentRegistrar on the component registry associated with this ApplicationConfigurer.
      Specified by:
      componentRegistry in interface ApplicationConfigurer
      Parameters:
      componentRegistrar - The actions to take on the component registry.
      Returns:
      This ApplicationConfigurer for a fluent API.
    • lifecycleRegistry

      public EventSourcingConfigurer lifecycleRegistry(@Nonnull Consumer<LifecycleRegistry> lifecycleRegistrar)
      Description copied from interface: ApplicationConfigurer
      Executes the given lifecycleRegistrar on the lifecycle registry associated with this ApplicationConfigurer.
      Specified by:
      lifecycleRegistry in interface ApplicationConfigurer
      Parameters:
      lifecycleRegistrar - The actions to take on the lifecycle registry.
      Returns:
      This ApplicationConfigurer for a fluent API.
    • build

      public AxonConfiguration build()
      Description copied from interface: ApplicationConfigurer
      Returns the completely initialized Configuration instance of type C built using this Configurer implementation.

      It is not recommended to change any configuration on this ApplicationConfigurer once this method is called.

      Specified by:
      build in interface ApplicationConfigurer
      Returns:
      The fully initialized Configuration instance of type C.