Class DefaultConfigurer
- All Implemented Interfaces:
Configurer,LifecycleOperations
- Direct Known Subclasses:
SpringConfigurer
Using defaultConfiguration(), you will get a Configurer instance with default components configured. You
will need to register your Aggregates (using configureAggregate(AggregateConfiguration) and provide a
repository implementation for each of them, or if you wish to use event sourcing, register your aggregates through
Configurer.configureAggregate(Class) and configure an Event Store (Configurer.configureEventStore(Function) or
configureEmbeddedEventStore(Function)).
Use buildConfiguration() to build the configuration, which provides access to the configured building
blocks, such as the CommandBus and EventBus.
Note that this Configurer implementation is not thread-safe.
- Since:
- 3.0
- Author:
- Allard Buijze
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the completely initialized Configuration built using this configurer.<A> ConfigurerconfigureAggregate(AggregateConfiguration<A> aggregateConfiguration) Configures an Aggregate in this configuration based on the givenaggregateConfiguration.configureCorrelationDataProviders(Function<Configuration, List<CorrelationDataProvider>> correlationDataProviderBuilder) Configures the CorrelationDataProviders that Message processing components should use to attach correlation data to outgoing messages.configureEmbeddedEventStore(Function<Configuration, EventStorageEngine> storageEngineBuilder) Configures an Embedded Event Store which uses the given Event Storage Engine to store its events.configureEventSerializer(Function<Configuration, Serializer> eventSerializerBuilder) Configures the given event Serializer to use in this configuration.configureLifecyclePhaseTimeout(long timeout, TimeUnit timeUnit) Configures the timeout of each lifecycle phase.configureMessageMonitor(Class<?> componentType, String componentName, MessageMonitorFactory messageMonitorFactory) Configures the factory create the Message Monitor for those Message processing components in this configuration that match the given class and name.configureMessageMonitor(Class<?> componentType, MessageMonitorFactory messageMonitorFactory) Configures the factory to create the Message Monitor for the Message processing components in this configuration that match the given componentType, unless more specific configuration based on both type and name is available.configureMessageMonitor(Function<Configuration, BiFunction<Class<?>, String, MessageMonitor<Message<?>>>> builder) Configures the Message Monitor to use for the Message processing components in this configuration, unless more specific configuration based on the component's type, or type and name is available.configureMessageSerializer(Function<Configuration, Serializer> messageSerializerBuilder) Configures the given event Serializer to use in this configuration.protected CommandBusdefaultCommandBus(Configuration config) Provides the default CommandBus implementation.protected CommandBusSpanFactoryReturns the defaultCommandBusSpanFactory, or aDefaultCommandBusSpanFactorybacked by the configuredSpanFactoryif none it set.protected CommandGatewaydefaultCommandGateway(Configuration config) Returns aDefaultCommandGatewaythat will use the configuration'sCommandBusto dispatch commands.protected <T> Optional<T> defaultComponent(Class<T> type, Configuration configuration) Method returning a default component to use for giventypefor givenconfiguration, or an empty Optional if no default can be provided.static ConfigurerReturns a Configurer instance with default components configured, such as aSimpleCommandBusandSimpleEventBus.static ConfigurerdefaultConfiguration(boolean autoLocateConfigurerModules) Returns a Configurer instance with default components configured, such as aSimpleCommandBusandSimpleEventBus, indicating whether toautoLocateConfigurerModules.protected DeadlineManagerdefaultDeadlineManager(Configuration config) Provides the defaultDeadlineManagerimplementation.protected DeadlineManagerSpanFactoryReturns the defaultDeadlineManagerSpanFactory, or aDefaultDeadlineManagerSpanFactorybacked by the configuredSpanFactoryif none it set.protected EventBusdefaultEventBus(Configuration config) Provides the default EventBus implementation.protected EventBusSpanFactoryReturns the defaultEventBusSpanFactory, or aDefaultEventBusSpanFactorybacked by the configuredSpanFactoryif none it set.protected EventGatewaydefaultEventGateway(Configuration config) Returns aDefaultEventGatewaythat will use the configuration'sEventBusto publish events.protected EventProcessorSpanFactoryReturns the defaultEventProcessorSpanFactory, or aDefaultEventProcessorSpanFactorybacked by the configuredSpanFactoryif none it set.protected HandlerDefinitiondefaultHandlerDefinition(Class<?> inspectedClass) Provides the default HandlerDefinition.protected ParameterResolverFactoryProvides the default ParameterResolverFactory.protected QueryBusdefaultQueryBus(Configuration config) Provides the default QueryBus implementations.protected QueryBusSpanFactoryReturns the defaultQueryBusSpanFactory, or aDefaultQueryBusSpanFactorybacked by the configuredSpanFactoryif none it set.protected QueryGatewaydefaultQueryGateway(Configuration config) Returns aDefaultQueryGatewaythat will use the configuration'sQueryBusto dispatch queries.protected QueryUpdateEmitterProvides the default QueryUpdateEmitter implementation.protected QueryUpdateEmitterSpanFactoryReturns the defaultQueryUpdateEmitterSpanFactory, or aDefaultQueryUpdateEmitterSpanFactorybacked by the configuredSpanFactoryif none it set.protected RepositorySpanFactoryReturns the defaultRepositorySpanFactory, or aDefaultRepositorySpanFactorybacked by the configuredSpanFactoryif none it set.protected ResourceInjectordefaultResourceInjector(Configuration config) Returns aConfigurationResourceInjectorthat injects resources defined in the givenconfig Configuration.protected SagaManagerSpanFactoryReturns the defaultSagaManagerSpanFactory, or aDefaultSagaManagerSpanFactorybacked by the configuredSpanFactoryif none it set.protected ScopeAwareProviderprotected SerializerdefaultSerializer(Configuration config) Provides the default Serializer implementation.protected SnapshotterdefaultSnapshotter(Configuration config) Provides the defaultSnapshotterimplementation, defaulting to aAggregateSnapshotter.protected SnapshotterSpanFactoryReturns the defaultSnapshotterSpanFactory, or aDefaultSnapshotterSpanFactorybacked by the configuredSpanFactoryif none it set.protected SpanFactorydefaultSpanFactory(Configuration config) Returns the defaultSpanFactory, or aNoOpSpanFactoryif none it set.protected EventUpcasterChaindefaultUpcasterChain(Configuration config) Provides the defaultEventUpcasterChainimplementation, looping through allregisteredEventUpcastersto collect them for a freshEventUpcasterChain.Retrieve theEventProcessingConfigurerregistered as a module with this Configurer.Returns a map of all registered components in this configuration.protected ConfigurationReturns the current Configuration object being built by this Configurer, without initializing it.protected voidCalls all registered init handlers.protected voidInvokes all registered shutdown handlers.protected voidInvokes all registered start handlers.static ConfigurerjpaConfiguration(EntityManagerProvider entityManagerProvider) Returns a Configurer instance which has JPA versions of building blocks configured, such as a JPA based Event Store (seeJpaEventStorageEngine), aJpaTokenStoreandJpaSagaStore.static ConfigurerjpaConfiguration(EntityManagerProvider entityManagerProvider, TransactionManager transactionManager) Returns a Configurer instance which has JPA versions of building blocks configured, such as a JPA based Event Store (seeJpaEventStorageEngine), aJpaTokenStoreandJpaSagaStore.voidonShutdown(int phase, LifecycleHandler shutdownHandler) Registers an asynchronousshutdownHandlerto be executed in the givenphasewhen the Configuration is shut down.voidonStart(int phase, LifecycleHandler startHandler) Registers an asynchronousstartHandlerto be executed in the givenphasewhen this Configuration is started.protected voidPrepare the registered message handlersMessageHandlerRegistrarfor initialization.protected voidPrepare the registered modules for initialization.registerCommandHandler(Function<Configuration, Object> commandHandlerBuilder) Registers a command handler bean with thisConfigurer.<C> ConfigurerregisterComponent(Class<C> componentType, Function<Configuration, ? extends C> componentBuilder) Registers a component which should be made available to other components or modules in this Configuration.registerEventUpcaster(Function<Configuration, EventUpcaster> upcasterBuilder) Registers an upcaster to be used to upcast Events to a newer versionregisterHandlerDefinition(BiFunction<Configuration, Class, HandlerDefinition> handlerDefinitionClass) Registers the definition of a Handler class.registerHandlerEnhancerDefinition(Function<Configuration, HandlerEnhancerDefinition> handlerEnhancerBuilder) Registers a builder function for aHandlerEnhancerDefinitionused during constructing of the defaultHandlerDefinition.registerMessageHandler(Function<Configuration, Object> messageHandlerBuilder) Registers a message handler bean with this configuration.registerModule(ModuleConfiguration module) Registers an Axon module with this configuration.registerQueryHandler(Function<Configuration, Object> queryHandlerBuilder) Registers a query handler bean with thisConfigurer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.config.Configurer
configureAggregate, configureCommandBus, configureDeadlineManager, configureEventBus, configureEventStore, configureMessageMonitor, configureMessageMonitor, configureQueryBus, configureQueryUpdateEmitter, configureResourceInjector, configureSerializer, configureSnapshotter, configureSpanFactory, configureTags, configureTransactionManager, eventProcessing, onInitialize, registerCommandHandler, registerEventHandler, registerQueryHandler, startMethods inherited from interface org.axonframework.config.LifecycleOperations
onShutdown, onShutdown, onStart, onStart
-
Constructor Details
-
DefaultConfigurer
protected DefaultConfigurer()Initialize the Configurer.
-
-
Method Details
-
defaultConfiguration
Returns a Configurer instance with default components configured, such as aSimpleCommandBusandSimpleEventBus.- Returns:
- Configurer instance for further configuration.
-
defaultConfiguration
Returns a Configurer instance with default components configured, such as aSimpleCommandBusandSimpleEventBus, indicating whether toautoLocateConfigurerModules.When
autoLocateConfigurerModulesistrue, a ServiceLoader will be used to locate all declared instances of typeConfigurerModule. Each of the discovered instances will be invoked, allowing it to set default values for the configuration.- Parameters:
autoLocateConfigurerModules- flag indicating whether ConfigurerModules on the classpath should be automatically retrieved. Should be set tofalsewhen using an application container, such as Spring or CDI.- Returns:
- Configurer instance for further configuration.
-
jpaConfiguration
public static Configurer jpaConfiguration(EntityManagerProvider entityManagerProvider, TransactionManager transactionManager) Returns a Configurer instance which has JPA versions of building blocks configured, such as a JPA based Event Store (seeJpaEventStorageEngine), aJpaTokenStoreandJpaSagaStore.
This method allows to provide a transaction manager for usage in JTA-managed entity manager.- Parameters:
entityManagerProvider- The instance that provides access to the JPA EntityManager.transactionManager- TransactionManager to be used for accessing the entity manager.- Returns:
- A Configurer instance for further configuration.
-
jpaConfiguration
Returns a Configurer instance which has JPA versions of building blocks configured, such as a JPA based Event Store (seeJpaEventStorageEngine), aJpaTokenStoreandJpaSagaStore.
This configuration should be used with an entity manager running without JTA transaction. If you are using a entity manager in JTA mode, please provide the correspondingTransactionManagerin thejpaConfiguration(EntityManagerProvider, TransactionManager)method.- Parameters:
entityManagerProvider- The instance that provides access to the JPA EntityManager.- Returns:
- A Configurer instance for further configuration.
-
defaultComponent
Method returning a default component to use for giventypefor givenconfiguration, or an empty Optional if no default can be provided.- Type Parameters:
T- The type of component.- Parameters:
type- The type of component to find a default for.configuration- The configuration the component is configured in.- Returns:
- An Optional containing a default component, or empty if none can be provided.
-
defaultCommandGateway
Returns aDefaultCommandGatewaythat will use the configuration'sCommandBusto dispatch commands.- Parameters:
config- The configuration that supplies the command bus.- Returns:
- The default command gateway.
-
defaultQueryGateway
Returns aDefaultQueryGatewaythat will use the configuration'sQueryBusto dispatch queries.- Parameters:
config- The configuration that supplies the query bus.- Returns:
- The default query gateway.
-
defaultQueryBus
Provides the default QueryBus implementations. Subclasses may override this method to provide their own default.- Parameters:
config- The configuration based on which the component is initialized.- Returns:
- The default QueryBus to use.
-
defaultQueryUpdateEmitter
Provides the default QueryUpdateEmitter implementation. Subclasses may override this method to provide their own default.- Parameters:
config- The configuration based on which the component is initialized- Returns:
- The default QueryUpdateEmitter to use
-
defaultParameterResolverFactory
Provides the default ParameterResolverFactory. Subclasses may override this method to provide their own default.- Parameters:
config- The configuration based on which the component is initialized.- Returns:
- The default ParameterResolverFactory to use.
-
defaultHandlerDefinition
Provides the default HandlerDefinition. Subclasses may override this method to provide their own default.- Parameters:
inspectedClass- The class being inspected for handlers- Returns:
- The default HandlerDefinition to use
-
defaultCommandBus
Provides the default CommandBus implementation. Subclasses may override this method to provide their own default.- Parameters:
config- The configuration based on which the component is initialized.- Returns:
- The default CommandBus to use.
-
defaultResourceInjector
Returns aConfigurationResourceInjectorthat injects resources defined in the givenconfig Configuration.- Parameters:
config- The configuration that supplies registered components.- Returns:
- A resource injector that supplies components registered with the configuration.
-
defaultScopeAwareProvider
Returns aScopeAwareProviderthat providesScopeAwareinstances to be used by aDeadlineManager. Uses the givenconfigto construct the defaultConfigurationScopeAwareProvider.- Parameters:
config- the configuration used to construct the defaultConfigurationScopeAwareProvider- Returns:
- a
ScopeAwareProviderthat providesScopeAwareinstances to be used by aDeadlineManager
-
defaultDeadlineManager
Provides the defaultDeadlineManagerimplementation. Subclasses may override this method to provide their own default.- Parameters:
config- The configuration that supplies registered components.- Returns:
- The default DeadlineManager to use
-
defaultEventBus
Provides the default EventBus implementation. Subclasses may override this method to provide their own default.- Parameters:
config- The configuration based on which the component is initialized.- Returns:
- The default EventBus to use.
-
defaultEventGateway
Returns aDefaultEventGatewaythat will use the configuration'sEventBusto publish events.- Parameters:
config- The configuration that supplies the event bus.- Returns:
- The default event gateway.
-
defaultSpanFactory
Returns the defaultSpanFactory, or aNoOpSpanFactoryif none it set.- Parameters:
config- The configuration that supplies the span factory.- Returns:
- The default
SpanFactory.
-
defaultSnapshotterSpanFactory
Returns the defaultSnapshotterSpanFactory, or aDefaultSnapshotterSpanFactorybacked by the configuredSpanFactoryif none it set.- Parameters:
config- The configuration that supplies the span factory.- Returns:
- The default
SnapshotterSpanFactory.
-
defaultCommandBusSpanFactory
Returns the defaultCommandBusSpanFactory, or aDefaultCommandBusSpanFactorybacked by the configuredSpanFactoryif none it set.- Parameters:
config- The configuration that supplies the span factory.- Returns:
- The default
CommandBusSpanFactory.
-
defaultQueryBusSpanFactory
Returns the defaultQueryBusSpanFactory, or aDefaultQueryBusSpanFactorybacked by the configuredSpanFactoryif none it set.- Parameters:
config- The configuration that supplies the span factory.- Returns:
- The default
QueryBusSpanFactory.
-
defaultQueryUpdateEmitterSpanFactory
Returns the defaultQueryUpdateEmitterSpanFactory, or aDefaultQueryUpdateEmitterSpanFactorybacked by the configuredSpanFactoryif none it set.- Parameters:
config- The configuration that supplies the span factory.- Returns:
- The default
QueryUpdateEmitterSpanFactory.
-
defaultEventBusSpanFactory
Returns the defaultEventBusSpanFactory, or aDefaultEventBusSpanFactorybacked by the configuredSpanFactoryif none it set.- Parameters:
config- The configuration that supplies the span factory.- Returns:
- The default
EventBusSpanFactory.
-
defaultDeadlineManagerSpanFactory
Returns the defaultDeadlineManagerSpanFactory, or aDefaultDeadlineManagerSpanFactorybacked by the configuredSpanFactoryif none it set.- Parameters:
config- The configuration that supplies the span factory.- Returns:
- The default
DeadlineManagerSpanFactory.
-
defaultRepositorySpanFactory
Returns the defaultRepositorySpanFactory, or aDefaultRepositorySpanFactorybacked by the configuredSpanFactoryif none it set.- Parameters:
config- The configuration that supplies the span factory.- Returns:
- The default
RepositorySpanFactory.
-
defaultEventProcessorSpanFactory
Returns the defaultEventProcessorSpanFactory, or aDefaultEventProcessorSpanFactorybacked by the configuredSpanFactoryif none it set.- Parameters:
config- The configuration that supplies the span factory.- Returns:
- The default
EventProcessorSpanFactory.
-
defaultSagaManagerSpanFactory
Returns the defaultSagaManagerSpanFactory, or aDefaultSagaManagerSpanFactorybacked by the configuredSpanFactoryif none it set.- Parameters:
config- The configuration that supplies the span factory.- Returns:
- The default
SagaManagerSpanFactory.
-
defaultSerializer
Provides the default Serializer implementation. Subclasses may override this method to provide their own default.- Parameters:
config- The configuration based on which the component is initialized.- Returns:
- The default Serializer to use.
-
defaultUpcasterChain
Provides the defaultEventUpcasterChainimplementation, looping through allregisteredEventUpcastersto collect them for a freshEventUpcasterChain. Subclasses may override this method to provide their own default.- Parameters:
config- The configuration based on which the component is initialized.- Returns:
- The default EventUpcasterChain to use.
-
defaultSnapshotter
Provides the defaultSnapshotterimplementation, defaulting to aAggregateSnapshotter. Subclasses may override this method to provide their own default.- Parameters:
config- the configuration based on which theSnapshotterwill be initialized- Returns:
- the default
Snapshotter
-
eventProcessing
Description copied from interface:ConfigurerRetrieve theEventProcessingConfigurerregistered as a module with this Configurer. If there aren't any, it will create anEventProcessingModuleand register it as a module. If there are multiple, anAxonConfigurationExceptionis thrown.- Specified by:
eventProcessingin interfaceConfigurer- Returns:
- an instance of Event Processing Configurer
-
registerEventUpcaster
public Configurer registerEventUpcaster(@Nonnull Function<Configuration, EventUpcaster> upcasterBuilder) Description copied from interface:ConfigurerRegisters an upcaster to be used to upcast Events to a newer version- Specified by:
registerEventUpcasterin interfaceConfigurer- Parameters:
upcasterBuilder- The function that returns an EventUpcaster based on the configuration- Returns:
- the current instance of the Configurer, for chaining purposes
-
configureMessageMonitor
public Configurer configureMessageMonitor(@Nonnull Function<Configuration, BiFunction<Class<?>, String, MessageMonitor<Message<?>>>> builder) Description copied from interface:ConfigurerConfigures the Message Monitor to use for the Message processing components in this configuration, unless more specific configuration based on the component's type, or type and name is available. The builder function receives the type of component as well as its name as input, and is expected to return a MessageMonitor instance to be used by that type of component.- Specified by:
configureMessageMonitorin interfaceConfigurer- Parameters:
builder- The MessageMonitor builder function- Returns:
- the current instance of the Configurer, for chaining purposes
-
configureMessageMonitor
public Configurer configureMessageMonitor(@Nonnull Class<?> componentType, @Nonnull MessageMonitorFactory messageMonitorFactory) Description copied from interface:ConfigurerConfigures the factory to create the Message Monitor for the Message processing components in this configuration that match the given componentType, unless more specific configuration based on both type and name is available.A component matches componentType if componentType is assignable from the component's class. If a component matches multiple types, and the types derive from each other, the configuration from the most derived type is used. If the matching types do not derive from each other, the result is unspecified.
For example: in case a monitor is configured for
CommandBusand another monitor is configured forSimpleCommandBus), components of typeAsynchronousCommandBuswill use the monitor configured for the SimpleCommandBus.A component's name matches componentName if they are identical; i.e. they are compared case sensitively.
- Specified by:
configureMessageMonitorin interfaceConfigurer- Parameters:
componentType- The declared type of the componentmessageMonitorFactory- The factory to use- Returns:
- the current instance of the Configurer, for chaining purposes
-
configureMessageMonitor
public Configurer configureMessageMonitor(@Nonnull Class<?> componentType, @Nonnull String componentName, @Nonnull MessageMonitorFactory messageMonitorFactory) Description copied from interface:ConfigurerConfigures the factory create the Message Monitor for those Message processing components in this configuration that match the given class and name.A component matches componentType if componentType is assignable from the component's class. If a component matches multiple types, and the types derive from each other, the configuration from the most derived type is used. If the matching types do not derive from each other, the result is unspecified.
For example: in case a monitor is configured for
CommandBusand another monitor is configured forSimpleCommandBus), components of typeAsynchronousCommandBuswill use the monitor configured for the SimpleCommandBus.A component's name matches componentName if they are identical; i.e. they are compared case sensitively.
- Specified by:
configureMessageMonitorin interfaceConfigurer- Parameters:
componentType- The declared type of the componentcomponentName- The name of the componentmessageMonitorFactory- The factory to use- Returns:
- the current instance of the Configurer, for chaining purposes
-
configureCorrelationDataProviders
public Configurer configureCorrelationDataProviders(@Nonnull Function<Configuration, List<CorrelationDataProvider>> correlationDataProviderBuilder) Description copied from interface:ConfigurerConfigures the CorrelationDataProviders that Message processing components should use to attach correlation data to outgoing messages. The builder function receives the Configuration as input and is expected to return a list or CorrelationDataProviders.- Specified by:
configureCorrelationDataProvidersin interfaceConfigurer- Parameters:
correlationDataProviderBuilder- the builder function returning the CorrelationDataProvider list- Returns:
- the current instance of the Configurer, for chaining purposes
-
registerModule
Description copied from interface:ConfigurerRegisters an Axon module with this configuration. The module is initialized when the configuration is created and has access to the global configuration when initialized.Typically, modules are registered for Event Handling components or Sagas.
- Specified by:
registerModulein interfaceConfigurer- Parameters:
module- The module to register- Returns:
- the current instance of the Configurer, for chaining purposes
- See Also:
-
registerComponent
public <C> Configurer registerComponent(@Nonnull Class<C> componentType, @Nonnull Function<Configuration, ? extends C> componentBuilder) Description copied from interface:ConfigurerRegisters a component which should be made available to other components or modules in this Configuration. The builder function gets this configuration as input, and is expected to provide the component as output.Where possible, it is recommended to use the explicit
configure...andregister...methods.- Specified by:
registerComponentin interfaceConfigurer- Type Parameters:
C- The type of component- Parameters:
componentType- The declared type of the component, typically an interfacecomponentBuilder- The builder function of this component- Returns:
- the current instance of the Configurer, for chaining purposes
-
registerCommandHandler
public Configurer registerCommandHandler(@Nonnull Function<Configuration, Object> commandHandlerBuilder) Description copied from interface:ConfigurerRegisters a command handler bean with thisConfigurer. The bean may be of any type. The actual command handler methods will be detected based on the annotations present on the bean's methods. Message handling functions annotated withCommandHandlerwill be taken into account.The builder function receives the
Configurationas input, and is expected to return a fully initialized instance of the command handler bean.- Specified by:
registerCommandHandlerin interfaceConfigurer- Parameters:
commandHandlerBuilder- the builder function of the command handler bean- Returns:
- the current instance of the
Configurer, for chaining purposes
-
registerQueryHandler
Description copied from interface:ConfigurerRegisters a query handler bean with thisConfigurer. The bean may be of any type. The actual query handler methods will be detected based on the annotations present on the bean's methods. Message handling functions annotated withQueryHandlerwill be taken into account.The builder function receives the
Configurationas input, and is expected to return a fully initialized instance of the query handler bean.- Specified by:
registerQueryHandlerin interfaceConfigurer- Parameters:
queryHandlerBuilder- the builder function of the query handler bean- Returns:
- the current instance of the
Configurer, for chaining purposes
-
registerMessageHandler
public Configurer registerMessageHandler(@Nonnull Function<Configuration, Object> messageHandlerBuilder) Description copied from interface:ConfigurerRegisters a message handler bean with this configuration. The bean may be of any type. The actual message handler methods will be detected based on the annotations present on the bean's methods. Message handling functions annotated withCommandHandler,EventHandlerandQueryHandlerwill be taken into account.The builder function receives the
Configurationas input, and is expected to return a fully initialized instance of the message handler bean.- Specified by:
registerMessageHandlerin interfaceConfigurer- Parameters:
messageHandlerBuilder- the builder function of the message handler bean- Returns:
- the current instance of the
Configurer, for chaining purposes
-
configureEmbeddedEventStore
public Configurer configureEmbeddedEventStore(@Nonnull Function<Configuration, EventStorageEngine> storageEngineBuilder) Description copied from interface:ConfigurerConfigures an Embedded Event Store which uses the given Event Storage Engine to store its events. The builder receives the Configuration as input and is expected to return a fully initializedEventStorageEngineinstance.- Specified by:
configureEmbeddedEventStorein interfaceConfigurer- Parameters:
storageEngineBuilder- The builder function for theEventStorageEngine- Returns:
- the current instance of the Configurer, for chaining purposes
-
configureEventSerializer
public Configurer configureEventSerializer(@Nonnull Function<Configuration, Serializer> eventSerializerBuilder) Description copied from interface:ConfigurerConfigures the given event Serializer to use in this configuration. The builder receives the Configuration as input and is expected to return a fully initializedSerializerinstance. This Serializer is specifically used to serialize EventMessage payload and metadata.- Specified by:
configureEventSerializerin interfaceConfigurer- Parameters:
eventSerializerBuilder- The builder function for theSerializer.- Returns:
- The current instance of the Configurer, for chaining purposes.
-
configureMessageSerializer
public Configurer configureMessageSerializer(@Nonnull Function<Configuration, Serializer> messageSerializerBuilder) Description copied from interface:ConfigurerConfigures the given event Serializer to use in this configuration. The builder receives the Configuration as input and is expected to return a fully initializedSerializerinstance. This Serializer is specifically used to serialize Message payload and Metadata.- Specified by:
configureMessageSerializerin interfaceConfigurer- Parameters:
messageSerializerBuilder- The builder function for theSerializer.- Returns:
- The current instance of the Configurer, for chaining purposes.
-
configureAggregate
Description copied from interface:ConfigurerConfigures an Aggregate in this configuration based on the givenaggregateConfiguration. This method allows for more fine-grained configuration compared to theConfigurer.configureAggregate(Class)method.- Specified by:
configureAggregatein interfaceConfigurer- Type Parameters:
A- The type of aggregate the configuration is for- Parameters:
aggregateConfiguration- The instance describing the configuration of an Aggregate- Returns:
- the current instance of the Configurer, for chaining purposes
- See Also:
-
registerHandlerDefinition
public Configurer registerHandlerDefinition(@Nonnull BiFunction<Configuration, Class, HandlerDefinition> handlerDefinitionClass) Description copied from interface:ConfigurerRegisters the definition of a Handler class. Defaults to annotation based recognition of handler methods.- Specified by:
registerHandlerDefinitionin interfaceConfigurer- Parameters:
handlerDefinitionClass- A function providing the definition based on the current Configuration as well as the class being inspected.- Returns:
- the current instance of the Configurer, for chaining purposes
-
registerHandlerEnhancerDefinition
public Configurer registerHandlerEnhancerDefinition(Function<Configuration, HandlerEnhancerDefinition> handlerEnhancerBuilder) Description copied from interface:ConfigurerRegisters a builder function for aHandlerEnhancerDefinitionused during constructing of the defaultHandlerDefinition.Any number of handler enhancer builder functions can be registered through this method. Note that any
HandlerEnhancerDefinitionsregistered through this method are ignored for handlers matching the type used in theConfigurer.registerHandlerDefinition(BiFunction)method's lambda.- Specified by:
registerHandlerEnhancerDefinitionin interfaceConfigurer- Parameters:
handlerEnhancerBuilder- A lambda constructing aHandlerEnhancerDefinitionbased on theConfiguration.- Returns:
- The current instance of the
Configurer, for chaining purposes.
-
configureLifecyclePhaseTimeout
Description copied from interface:ConfigurerConfigures the timeout of each lifecycle phase. The Configurer invokes lifecycle phases during start-up and shutdown of an application.Note that if a lifecycle phase exceeds the configured
timeoutandtimeUnitcombination, the Configurer will proceed with the following phase. A phase-skip is marked with a warn logging message, as the chances are high this causes undesired side effects.The default lifecycle phase timeout is five seconds.
- Specified by:
configureLifecyclePhaseTimeoutin interfaceConfigurer- Parameters:
timeout- the amount of time to wait for lifecycle phase completiontimeUnit- the unit in which thetimeoutis expressed- Returns:
- the current instance of the Configurer, for chaining purposes
- See Also:
-
buildConfiguration
Description copied from interface:ConfigurerReturns the completely initialized Configuration built using this configurer. It is not recommended to change any configuration on this Configurer once this method is called.- Specified by:
buildConfigurationin interfaceConfigurer- Returns:
- the fully initialized Configuration
-
prepareModules
protected void prepareModules()Prepare the registered modules for initialization. This ensures all lifecycle handlers are registered. -
prepareMessageHandlerRegistrars
protected void prepareMessageHandlerRegistrars()Prepare the registered message handlersMessageHandlerRegistrarfor initialization. This ensures their lifecycle handlers are registered. -
invokeInitHandlers
protected void invokeInitHandlers()Calls all registered init handlers. Registration of init handlers after this invocation will result in an immediate invocation of that handler. -
invokeStartHandlers
protected void invokeStartHandlers()Invokes all registered start handlers. -
invokeShutdownHandlers
protected void invokeShutdownHandlers()Invokes all registered shutdown handlers. -
getConfig
Returns the current Configuration object being built by this Configurer, without initializing it. Note that retrieving objects from this configuration may lead to premature initialization of certain components.- Returns:
- The current Configuration object being built by this Configurer.
-
getComponents
Returns a map of all registered components in this configuration. The key of the map is the registered component type (typically an interface), the value is a Component instance that wraps the actual implementation. Note that callingComponent.get()may prematurely initialize a component.- Returns:
- A map of all registered components in this configuration.
-
onStart
Description copied from interface:LifecycleOperationsRegisters an asynchronousstartHandlerto be executed in the givenphasewhen this Configuration is started.The behavior for handlers that are registered when the Configuration is already started is undefined.
- Specified by:
onStartin interfaceLifecycleOperations- Parameters:
phase- defines aphasein which the start handler will be invoked duringConfiguration.start(). When starting the configuration the given handlers are started in ascending order based on theirphasestartHandler- the handler to be executed asynchronously when the configuration is started- See Also:
-
onShutdown
Description copied from interface:LifecycleOperationsRegisters an asynchronousshutdownHandlerto be executed in the givenphasewhen the Configuration is shut down.The behavior for handlers that are registered when the Configuration is already shut down is undefined.
- Specified by:
onShutdownin interfaceLifecycleOperations- Parameters:
phase- defines a phase in which the shutdown handler will be invoked duringConfiguration.shutdown(). When shutting down the configuration the given handlers are executing in descending order based on theirphaseshutdownHandler- the handler to be executed asynchronously when the Configuration is shut down- See Also:
-