public interface Configurer
Using DefaultConfigurer.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 configureAggregate(Class)
and configure an Event Store (configureEventStore(Function)
or
configureEmbeddedEventStore(Function)
).
DefaultConfigurer
Modifier and Type | Method and Description |
---|---|
Configuration |
buildConfiguration()
Returns the completely initialized Configuration built using this configurer.
|
<A> Configurer |
configureAggregate(AggregateConfiguration<A> aggregateConfiguration)
Configures an Aggregate in this configuration based on the given
aggregateConfiguration . |
default <A> Configurer |
configureAggregate(Class<A> aggregate)
Configures an Aggregate using default settings.
|
default Configurer |
configureCommandBus(Function<Configuration,CommandBus> commandBusBuilder)
Configures the given Command Bus to use in this configuration.
|
Configurer |
configureCorrelationDataProviders(Function<Configuration,List<CorrelationDataProvider>> correlationDataProviderBuilder)
Configures the CorrelationDataProviders that Message processing components should use to attach correlation data
to outgoing messages.
|
Configurer |
configureEmbeddedEventStore(Function<Configuration,EventStorageEngine> storageEngineBuilder)
Configures an Embedded Event Store which uses the given Event Storage Engine to store its events.
|
default Configurer |
configureEventBus(Function<Configuration,EventBus> eventBusBuilder)
Configures the given Event Bus to use in this configuration.
|
Configurer |
configureEventSerializer(Function<Configuration,Serializer> eventSerializerBuilder)
Configures the given event Serializer to use in this configuration.
|
default Configurer |
configureEventStore(Function<Configuration,EventStore> eventStoreBuilder)
Configures the given Event Store to use in this configuration.
|
default Configurer |
configureMessageMonitor(Class<?> componentType,
Function<Configuration,MessageMonitor<Message<?>>> messageMonitorBuilder)
Configures the builder function 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.
|
Configurer |
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.
|
default Configurer |
configureMessageMonitor(Class<?> componentType,
String componentName,
Function<Configuration,MessageMonitor<Message<?>>> messageMonitorBuilder)
Configures the builder function to create the Message Monitor for the Message processing components in this
configuration that match the given class and name.
|
Configurer |
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.
|
Configurer |
configureMessageMonitor(Function<Configuration,BiFunction<Class<?>,String,MessageMonitor<Message<?>>>> messageMonitorFactoryBuilder)
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.
|
Configurer |
configureMessageSerializer(Function<Configuration,Serializer> messageSerializerBuilder)
Configures the given event Serializer to use in this configuration.
|
default Configurer |
configureQueryBus(Function<Configuration,QueryBus> queryBusBuilder)
Configures the given Query Bus to use in this configuration.
|
default Configurer |
configureQueryUpdateEmitter(Function<Configuration,QueryUpdateEmitter> queryUpdateEmitterBuilder)
Configures the given Query Update Emitter to use in this configuration.
|
default Configurer |
configureResourceInjector(Function<Configuration,ResourceInjector> resourceInjectorBuilder)
Configures the given Resource Injector to use for Sagas in this configuration.
|
default Configurer |
configureSerializer(Function<Configuration,Serializer> serializerBuilder)
Configures the given Serializer to use in this configuration.
|
default Configurer |
configureTransactionManager(Function<Configuration,TransactionManager> transactionManagerBuilder)
Configures the given Transaction Manager to use in this configuration.
|
EventProcessingConfigurer |
eventProcessing()
Retrieve the
EventProcessingConfigurer registered as a module with this Configurer. |
default Configurer |
eventProcessing(Consumer<EventProcessingConfigurer> eventProcessingConfigurer)
Locates the
EventProcessingConfigurer registered as a module with this Configurer and provides it to the
given consumer for configuration. |
default Configurer |
registerCommandHandler(Function<Configuration,Object> annotatedCommandHandlerBuilder)
Registers a command handler bean with this configuration.
|
Configurer |
registerCommandHandler(int phase,
Function<Configuration,Object> annotatedCommandHandlerBuilder)
Registers a command handler bean with this configuration.
|
<C> Configurer |
registerComponent(Class<C> componentType,
Function<Configuration,? extends C> componentBuilder)
Registers a component which should be made available to other components or modules in this Configuration.
|
default Configurer |
registerEventHandler(Function<Configuration,Object> eventHandlerBuilder)
Registers a
Function that builds an Event Handler instance. |
Configurer |
registerEventUpcaster(Function<Configuration,EventUpcaster> upcasterBuilder)
Registers an upcaster to be used to upcast Events to a newer version
|
Configurer |
registerHandlerDefinition(BiFunction<Configuration,Class,HandlerDefinition> handlerDefinitionClass)
Registers the definition of a Handler class.
|
Configurer |
registerModule(ModuleConfiguration module)
Registers an Axon module with this configuration.
|
default Configurer |
registerQueryHandler(Function<Configuration,Object> annotatedQueryHandlerBuilder)
Registers a query handler bean with this configuration.
|
Configurer |
registerQueryHandler(int phase,
Function<Configuration,Object> annotatedQueryHandlerBuilder)
Registers a query handler bean with this configuration.
|
default Configuration |
start()
Builds the configuration and starts it immediately.
|
Configurer registerEventUpcaster(Function<Configuration,EventUpcaster> upcasterBuilder)
upcasterBuilder
- The function that returns an EventUpcaster based on the configurationConfigurer configureMessageMonitor(Function<Configuration,BiFunction<Class<?>,String,MessageMonitor<Message<?>>>> messageMonitorFactoryBuilder)
messageMonitorFactoryBuilder
- The MessageMonitor builder functiondefault Configurer configureMessageMonitor(Class<?> componentType, Function<Configuration,MessageMonitor<Message<?>>> messageMonitorBuilder)
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 CommandBus
and another monitor is configured for
SimpleCommandBus
), components of type
AsynchronousCommandBus
will use the monitor
configured for the SimpleCommandBus.
A component's name matches componentName if they are identical; i.e. they are compared case sensitively.
componentType
- The declared type of the componentmessageMonitorBuilder
- The builder function to useConfigurer configureMessageMonitor(Class<?> componentType, MessageMonitorFactory messageMonitorFactory)
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 CommandBus
and another monitor is configured for
SimpleCommandBus
), components of type
AsynchronousCommandBus
will use the monitor
configured for the SimpleCommandBus.
A component's name matches componentName if they are identical; i.e. they are compared case sensitively.
componentType
- The declared type of the componentmessageMonitorFactory
- The factory to usedefault Configurer configureMessageMonitor(Class<?> componentType, String componentName, Function<Configuration,MessageMonitor<Message<?>>> messageMonitorBuilder)
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 CommandBus
and another monitor is configured for
SimpleCommandBus
), components of type
AsynchronousCommandBus
will use the monitor
configured for the SimpleCommandBus.
A component's name matches componentName if they are identical; i.e. they are compared case sensitively.
componentType
- The declared type of the componentcomponentName
- The name of the componentmessageMonitorBuilder
- The builder function to useConfigurer configureMessageMonitor(Class<?> componentType, String componentName, MessageMonitorFactory messageMonitorFactory)
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 CommandBus
and another monitor is configured for
SimpleCommandBus
), components of type
AsynchronousCommandBus
will use the monitor
configured for the SimpleCommandBus.
A component's name matches componentName if they are identical; i.e. they are compared case sensitively.
componentType
- The declared type of the componentcomponentName
- The name of the componentmessageMonitorFactory
- The factory to useConfigurer configureCorrelationDataProviders(Function<Configuration,List<CorrelationDataProvider>> correlationDataProviderBuilder)
correlationDataProviderBuilder
- the builder function returning the CorrelationDataProvider listConfigurer registerModule(ModuleConfiguration module)
Typically, modules are registered for Event Handling components or Sagas.
module
- The module to registerSagaConfiguration
<C> Configurer registerComponent(Class<C> componentType, Function<Configuration,? extends C> componentBuilder)
Where possible, it is recommended to use the explicit configure...
and register...
methods.
C
- The type of componentcomponentType
- The declared type of the component, typically an interfacecomponentBuilder
- The builder function of this componentdefault Configurer registerCommandHandler(Function<Configuration,Object> annotatedCommandHandlerBuilder)
The builder function receives the Configuration as input, and is expected to return a fully initialized instance of the command handler bean.
annotatedCommandHandlerBuilder
- The builder function of the Command Handler beanConfigurer registerCommandHandler(int phase, Function<Configuration,Object> annotatedCommandHandlerBuilder)
The builder function receives the Configuration as input, and is expected to return a fully initialized instance of the command handler bean.
annotatedCommandHandlerBuilder
- The builder function of the Command Handler beanphase
- defines a phase in which the command handler builder will be invoked during
Configuration.start()
and Configuration.shutdown()
. When
starting the configuration handlers are ordered in ascending, when shutting
down the configuration, descending order is used.default Configurer registerQueryHandler(Function<Configuration,Object> annotatedQueryHandlerBuilder)
The builder function receives the Configuration as input, and is expected to return a fully initialized instance of the query handler bean.
annotatedQueryHandlerBuilder
- The builder function of the Query Handler beanConfigurer registerQueryHandler(int phase, Function<Configuration,Object> annotatedQueryHandlerBuilder)
The builder function receives the Configuration as input, and is expected to return a fully initialized instance of the query handler bean.
annotatedQueryHandlerBuilder
- The builder function of the Query Handler beanphase
- defines a phase in which the query handler builder will be invoked during
Configuration.start()
and Configuration.shutdown()
. When
starting the configuration handlers are ordered in ascending, when shutting
down the configuration, descending order is used.Configurer configureEmbeddedEventStore(Function<Configuration,EventStorageEngine> storageEngineBuilder)
EventStorageEngine
instance.storageEngineBuilder
- The builder function for the EventStorageEngine
default Configurer configureEventStore(Function<Configuration,EventStore> eventStoreBuilder)
EventStore
instance.eventStoreBuilder
- The builder function for the EventStore
default Configurer configureEventBus(Function<Configuration,EventBus> eventBusBuilder)
EventBus
instance.
Note that this builder should not be used when an Event Store is configured. Since Axon 3, the Event Store will act as Event Bus implementation as well.
eventBusBuilder
- The builder function for the EventBus
default Configurer configureCommandBus(Function<Configuration,CommandBus> commandBusBuilder)
CommandBus
instance.commandBusBuilder
- The builder function for the CommandBus
default Configurer configureQueryBus(Function<Configuration,QueryBus> queryBusBuilder)
QueryBus
instance.queryBusBuilder
- The builder function for the QueryBus
default Configurer configureQueryUpdateEmitter(Function<Configuration,QueryUpdateEmitter> queryUpdateEmitterBuilder)
QueryUpdateEmitter
instance.queryUpdateEmitterBuilder
- The builder function for the QueryUpdateEmitter
default Configurer configureSerializer(Function<Configuration,Serializer> serializerBuilder)
Serializer
instance.serializerBuilder
- The builder function for the Serializer
Configurer configureEventSerializer(Function<Configuration,Serializer> eventSerializerBuilder)
Serializer
instance.
This Serializer is specifically used to serialize EventMessage payload and metadata.eventSerializerBuilder
- The builder function for the Serializer
.Configurer configureMessageSerializer(Function<Configuration,Serializer> messageSerializerBuilder)
Serializer
instance.
This Serializer is specifically used to serialize Message payload and Metadata.messageSerializerBuilder
- The builder function for the Serializer
.default Configurer configureTransactionManager(Function<Configuration,TransactionManager> transactionManagerBuilder)
TransactionManager
instance.transactionManagerBuilder
- The builder function for the TransactionManager
default Configurer configureResourceInjector(Function<Configuration,ResourceInjector> resourceInjectorBuilder)
ResourceInjector
instance.resourceInjectorBuilder
- The builder function for the ResourceInjector
<A> Configurer configureAggregate(AggregateConfiguration<A> aggregateConfiguration)
aggregateConfiguration
. This method
allows for more fine-grained configuration compared to the configureAggregate(Class)
method.A
- The type of aggregate the configuration is foraggregateConfiguration
- The instance describing the configuration of an AggregateAggregateConfigurer
default <A> Configurer configureAggregate(Class<A> aggregate)
configureAggregate(AggregateConfiguration)
must be used to register the aggregate.A
- The type of aggregateaggregate
- The aggregate type to register with the ConfigurationConfigurer registerHandlerDefinition(BiFunction<Configuration,Class,HandlerDefinition> handlerDefinitionClass)
handlerDefinitionClass
- A function providing the definition based on the current Configuration as well
as the class being inspected.EventProcessingConfigurer eventProcessing() throws AxonConfigurationException
EventProcessingConfigurer
registered as a module with this Configurer. If there aren't
any, it will create an EventProcessingModule
and register it as a module. If there are multiple,
an AxonConfigurationException
is thrown.AxonConfigurationException
- thrown if there are multiple EventProcessingConfigurer
sdefault Configurer eventProcessing(Consumer<EventProcessingConfigurer> eventProcessingConfigurer) throws AxonConfigurationException
EventProcessingConfigurer
registered as a module with this Configurer and provides it to the
given consumer for configuration. If there aren't any pre-registered instances of
EventProcessingConfigurer
, it will create an EventProcessingModule
and register it as a module.
If there are multiple, an AxonConfigurationException
is thrown.
This method is identical to using eventProcessing()
, except that this variant allows for easier fluent
interfacing.eventProcessingConfigurer
- a consumer to configure theAxonConfigurationException
- thrown if there are multiple EventProcessingConfigurer
sdefault Configurer registerEventHandler(Function<Configuration,Object> eventHandlerBuilder)
Function
that builds an Event Handler instance.eventHandlerBuilder
- a Function
that builds an Event Handler instance.Configuration buildConfiguration()
default Configuration start()
Copyright © 2010–2019. All rights reserved.