Class ModellingConfigurer

java.lang.Object
org.axonframework.modelling.configuration.ModellingConfigurer
All Implemented Interfaces:
ApplicationConfigurer

public class ModellingConfigurer extends Object implements ApplicationConfigurer
The modelling ApplicationConfigurer of Axon Framework's configuration API, providing registration methods to, for example, register a CommandHandlingModule.
Since:
5.0.0
Author:
Steven van Beelen
  • Constructor Details

    • ModellingConfigurer

      public ModellingConfigurer(@Nonnull MessagingConfigurer delegate)
      Construct a ModellingConfigurer using the given delegate to delegate all registry-specific operations to.

      It is recommended to use the create() method in most cases instead of this constructor.

      Parameters:
      delegate - The delegate MessagingConfigurer the ModellingConfigurer is based on.
  • Method Details

    • create

      public static ModellingConfigurer create()
      This configurer does not set any defaults other than the defaults granted by the MessagingConfigurer it wraps.

      Besides the specific operations, the ModellingConfigurer allows for configuring generic components, component decorators, enhancers, and modules for an application using entity modelling.

      Note that this configurer uses a MessagingConfigurer to support all this in a message-driven style.

      Returns:
      A ModellingConfigurer instance for further configuring.
    • enhance

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

      @Nonnull public ModellingConfigurer registerCommandHandlingModule(@Nonnull ModuleBuilder<CommandHandlingModule> moduleBuilder)
      Registers the given builder for a CommandHandlingModule 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. The sole exception to this, are Modules registered with the resulting CommandHandlingModule itself.

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

      @Nonnull public ModellingConfigurer registerQueryHandlingModule(@Nonnull ModuleBuilder<QueryHandlingModule> moduleBuilder)
      Registers the given builder for a QueryHandlingModule 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. The sole exception to this, are Modules registered with the resulting QueryHandlingModule itself.

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

      @Nonnull public <I, E> ModellingConfigurer 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:
      The current instance of the Configurer for a fluent API.
    • messaging

      public ModellingConfigurer messaging(@Nonnull Consumer<MessagingConfigurer> configurerTask)
      Delegates the given configurerTask to the MessagingConfigurer this ModellingConfigurer 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 ModellingConfigurer 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 ModellingConfigurer 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.