A
- The type of Aggregate configuredpublic class AggregateConfigurer<A> extends Object implements AggregateConfiguration<A>
Modifier | Constructor and Description |
---|---|
protected |
AggregateConfigurer(Class<A> aggregate)
Creates a default configuration as described in
defaultConfiguration(Class) . |
Modifier and Type | Method and Description |
---|---|
Class<A> |
aggregateType()
Returns the type of Aggregate defined in this Configuration.
|
AggregateConfigurer<A> |
configureAggregateFactory(Function<Configuration,AggregateFactory<A>> aggregateFactoryBuilder)
Defines the factory to use to to create new Aggregates instances of the type under configuration.
|
AggregateConfigurer<A> |
configureCommandHandler(Function<Configuration,AggregateAnnotationCommandHandler> aggregateCommandHandlerBuilder)
Defines the AggregateAnnotationCommandHandler instance to use.
|
AggregateConfigurer<A> |
configureCommandTargetResolver(Function<Configuration,CommandTargetResolver> commandTargetResolverBuilder)
Defines the CommandTargetResolver to use for the Aggregate type under configuration.
|
AggregateConfigurer<A> |
configureRepository(Function<Configuration,Repository<A>> repositoryBuilder)
Defines the repository to use to load and store Aggregates of this type.
|
AggregateConfigurer<A> |
configureSnapshotTrigger(Function<Configuration,SnapshotTriggerDefinition> snapshotTriggerDefinition)
Configures snapshotting for the Aggregate type under configuration.
|
static <A> AggregateConfigurer<A> |
defaultConfiguration(Class<A> aggregateType)
Creates a default Configuration for an aggregate of the given
aggregateType . |
void |
initialize(Configuration parent)
Initialize the module configuration using the given global
config |
static <A> AggregateConfigurer<A> |
jpaMappedConfiguration(Class<A> aggregateType)
Creates a Configuration for an aggregate of given
aggregateType , which is mapped to a relational
database using an EntityManager obtained from the main configuration. |
static <A> AggregateConfigurer<A> |
jpaMappedConfiguration(Class<A> aggregateType,
EntityManagerProvider entityManagerProvider)
Creates a Configuration for an aggregate of given
aggregateType , which is mapped to a relational
database using an EntityManager provided by given entityManagerProvider . |
Repository<A> |
repository()
Returns the repository defined to load instances of the Aggregate type defined in this configuration
|
void |
shutdown()
Invoked prior to shutdown of the application.
|
void |
start()
Invoked when the Configuration is started.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isType, phase, unwrap
protected AggregateConfigurer(Class<A> aggregate)
defaultConfiguration(Class)
. This constructor is
available for subclasses that provide additional configuration possibilities.aggregate
- The type of aggregate to configurepublic static <A> AggregateConfigurer<A> defaultConfiguration(Class<A> aggregateType)
aggregateType
. This required either a
Repository to be configured using configureRepository(Function)
, or that the Global Configuration
contains an Event Store and the Aggregate support Event Sourcing.A
- The type of Aggregate to configureaggregateType
- The type of Aggregate to configurepublic static <A> AggregateConfigurer<A> jpaMappedConfiguration(Class<A> aggregateType)
aggregateType
, which is mapped to a relational
database using an EntityManager obtained from the main configuration. The given aggregateType
is expected to be a proper JPA Entity.
The EntityManagerProvider is expected to have been registered with the Configurer (which would be the case when
using DefaultConfigurer.jpaConfiguration(EntityManagerProvider)
. If that is not the case, consider using
jpaMappedConfiguration(Class, EntityManagerProvider)
instead.
A
- The type of Aggregate to configureaggregateType
- The type of Aggregate to configurepublic static <A> AggregateConfigurer<A> jpaMappedConfiguration(Class<A> aggregateType, EntityManagerProvider entityManagerProvider)
aggregateType
, which is mapped to a relational
database using an EntityManager provided by given entityManagerProvider
. The given aggregateType
is expected to be a proper JPA Entity.A
- The type of Aggregate to configureaggregateType
- The type of Aggregate to configureentityManagerProvider
- The provider for Axon to retrieve the EntityManager frompublic AggregateConfigurer<A> configureRepository(Function<Configuration,Repository<A>> repositoryBuilder)
repositoryBuilder
- The builder function for the repositorypublic AggregateConfigurer<A> configureAggregateFactory(Function<Configuration,AggregateFactory<A>> aggregateFactoryBuilder)
aggregateFactoryBuilder
- The builder function for the AggregateFactorypublic AggregateConfigurer<A> configureCommandHandler(Function<Configuration,AggregateAnnotationCommandHandler> aggregateCommandHandlerBuilder)
aggregateCommandHandlerBuilder
- The builder function for the AggregateCommandHandlerpublic AggregateConfigurer<A> configureCommandTargetResolver(Function<Configuration,CommandTargetResolver> commandTargetResolverBuilder)
commandTargetResolverBuilder
- the builder function for the CommandTargetResolver.public AggregateConfigurer<A> configureSnapshotTrigger(Function<Configuration,SnapshotTriggerDefinition> snapshotTriggerDefinition)
Note that this configuration is ignored if a custom repository instance is configured.
snapshotTriggerDefinition
- The function creating the SnapshotTriggerDefinitionpublic void initialize(Configuration parent)
ModuleConfiguration
config
initialize
in interface ModuleConfiguration
parent
- the global configuration, providing access to generic componentspublic void start()
ModuleConfiguration
start
in interface ModuleConfiguration
Configuration.start()
public void shutdown()
ModuleConfiguration
shutdown
in interface ModuleConfiguration
Configuration.shutdown()
public Repository<A> repository()
AggregateConfiguration
repository
in interface AggregateConfiguration<A>
public Class<A> aggregateType()
AggregateConfiguration
aggregateType
in interface AggregateConfiguration<A>
Copyright © 2010–2019. All rights reserved.