public class DefaultConfigurer extends Object implements Configurer
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.
Modifier | Constructor and Description |
---|---|
protected |
DefaultConfigurer()
Initialize the Configurer
|
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 . |
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)
Configure an Embedded Event Store which uses the given Event Storage Engine to store its events.
|
Configurer |
configureMessageMonitor(Function<Configuration,BiFunction<Class<?>,String,MessageMonitor<Message<?>>>> messageMonitorFactoryBuilder)
Configure the Message Monitor to use for the Message processing components in this configuration.
|
protected CommandBus |
defaultCommandBus(Configuration config)
Provides the default CommandBus implementation.
|
protected CommandGateway |
defaultCommandGateway(Configuration config)
Returns a
DefaultCommandGateway that will use the configuration's CommandBus to dispatch
commands. |
static Configurer |
defaultConfiguration()
Returns a Configurer instance with default components configured, such as a
SimpleCommandBus and
SimpleEventBus . |
protected EventBus |
defaultEventBus(Configuration config)
Provides the default EventBus implementation.
|
protected ParameterResolverFactory |
defaultParameterResolverFactory(Configuration config)
Provides the default ParameterResolverFactory.
|
protected ResourceInjector |
defaultResourceInjector(Configuration config)
Returns a
ConfigurationResourceInjector that injects resources defined in the given config
Configuration . |
protected Serializer |
defaultSerializer(Configuration config)
Provides the default Serializer implementation.
|
Map<Class<?>,Component<?>> |
getComponents()
Returns a map of all registered components in this configuration.
|
protected Configuration |
getConfig()
Returns the current Configuration object being built by this Configurer, without initializing it.
|
protected void |
invokeInitHandlers()
Calls all registered init handlers.
|
protected void |
invokeShutdownHandlers()
Invokes all registered shutdown handlers
|
protected void |
invokeStartHandlers()
Invokes all registered start handlers
|
static Configurer |
jpaConfiguration(EntityManagerProvider entityManagerProvider)
Returns a Configurer instance which has JPA versions of building blocks configured, such as a JPA based Event
Store (see
JpaEventStorageEngine ), a JpaTokenStore and JpaSagaStore . |
Configurer |
registerCommandHandler(Function<Configuration,Object> annotatedCommandHandlerBuilder)
Registers a command handler bean with this configuration.
|
<C> Configurer |
registerComponent(Class<C> componentType,
Function<Configuration,? extends C> componentBuilder)
Register a component which should be made available to other components or modules in this Configuration.
|
Configurer |
registerModule(ModuleConfiguration module)
Register an Axon module with this configuration.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
configureAggregate, configureCommandBus, configureEventBus, configureEventStore, configureResourceInjector, configureSerializer, configureTransactionManager, start
public static Configurer defaultConfiguration()
SimpleCommandBus
and
SimpleEventBus
.public static Configurer jpaConfiguration(EntityManagerProvider entityManagerProvider)
JpaEventStorageEngine
), a JpaTokenStore
and JpaSagaStore
.entityManagerProvider
- The instance that provides access to the JPA EntityManagerprotected CommandGateway defaultCommandGateway(Configuration config)
DefaultCommandGateway
that will use the configuration's CommandBus
to dispatch
commands.config
- the configuration that supplies the command busprotected ParameterResolverFactory defaultParameterResolverFactory(Configuration config)
config
- The configuration based on which the component is initializedprotected CommandBus defaultCommandBus(Configuration config)
config
- The configuration based on which the component is initializedprotected ResourceInjector defaultResourceInjector(Configuration config)
ConfigurationResourceInjector
that injects resources defined in the given config
Configuration
.config
- the configuration that supplies registered componentsprotected EventBus defaultEventBus(Configuration config)
config
- The configuration based on which the component is initializedprotected Serializer defaultSerializer(Configuration config)
config
- The configuration based on which the component is initializedpublic Configurer configureMessageMonitor(Function<Configuration,BiFunction<Class<?>,String,MessageMonitor<Message<?>>>> messageMonitorFactoryBuilder)
Configurer
configureMessageMonitor
in interface Configurer
messageMonitorFactoryBuilder
- The MessageMonitor builder functionpublic Configurer configureCorrelationDataProviders(Function<Configuration,List<CorrelationDataProvider>> correlationDataProviderBuilder)
Configurer
configureCorrelationDataProviders
in interface Configurer
correlationDataProviderBuilder
- the builder function returning the CorrelationDataProvider listpublic Configurer registerModule(ModuleConfiguration module)
Configurer
Typically, modules are registered for Event Handling components or Sagas.
registerModule
in interface Configurer
module
- The module to registerSagaConfiguration
,
EventHandlingConfiguration
public Configurer registerCommandHandler(Function<Configuration,Object> annotatedCommandHandlerBuilder)
Configurer
The builder function receives the Configuration as input, and is expected to return a fully initialized instance of the command handler bean.
registerCommandHandler
in interface Configurer
annotatedCommandHandlerBuilder
- The builder function of the Command Handler beanpublic <C> Configurer registerComponent(Class<C> componentType, Function<Configuration,? extends C> componentBuilder)
Configurer
Where possible, it is recommended to use the explicit configure...
and register...
methods.
registerComponent
in interface Configurer
C
- The type of componentcomponentType
- The declared type of the components, typically an interfacecomponentBuilder
- The builder function of this componentpublic Configurer configureEmbeddedEventStore(Function<Configuration,EventStorageEngine> storageEngineBuilder)
Configurer
EventStorageEngine
instance.configureEmbeddedEventStore
in interface Configurer
storageEngineBuilder
- The builder function for the EventStorageEngine
public <A> Configurer configureAggregate(AggregateConfiguration<A> aggregateConfiguration)
Configurer
aggregateConfiguration
. This method
allows for more fine-grained configuration compared to the Configurer.configureAggregate(Class)
method.configureAggregate
in interface Configurer
A
- the type of aggregate the configuration is foraggregateConfiguration
- The instance describing the configuration of an AggregateAggregateConfigurer
public Configuration buildConfiguration()
Configurer
buildConfiguration
in interface Configurer
protected void invokeInitHandlers()
protected void invokeStartHandlers()
protected void invokeShutdownHandlers()
protected Configuration getConfig()
public Map<Class<?>,Component<?>> getComponents()
Component.get()
may prematurely initialize a component.Copyright © 2010–2017. All rights reserved.