public static class SpringAggregateSnapshotter.Builder extends AggregateSnapshotter.Builder
SpringAggregateSnapshotter
. The AggregateFactory
instances are lazily retrieved by the ApplicationContext
.
The Executor
is defaulted to an DirectExecutor.INSTANCE
and the
TransactionManager
defaults to a NoTransactionManager
.
Additionally, this Builder has convenience functions to default the ParameterResolverFactory
and
HandlerDefinition
based on instances of these available on the classpath in case these are not provided
(respectively AggregateSnapshotter.Builder.buildParameterResolverFactory()
and AggregateSnapshotter.Builder.buildHandlerDefinition()
).
Upon instantiation of a AggregateSnapshotter
, it is recommended to use these function to set those
fields.
The EventStore
is a hard requirement and as such should be provided.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
SpringAggregateSnapshotter |
build()
Initializes a
SpringAggregateSnapshotter as specified through this Builder. |
SpringAggregateSnapshotter.Builder |
eventStore(EventStore eventStore)
Sets the
EventStore instance which this AbstractSnapshotter implementation will store
snapshots in. |
SpringAggregateSnapshotter.Builder |
executor(Executor executor)
Sets the
Executor which handles the actual snapshot creation process. |
SpringAggregateSnapshotter.Builder |
handlerDefinition(HandlerDefinition handlerDefinition)
Sets the
HandlerDefinition used to create concrete handlers in the snapshot aggregate this
snapshotter creates. |
SpringAggregateSnapshotter.Builder |
parameterResolverFactory(ParameterResolverFactory parameterResolverFactory)
Sets the
ParameterResolverFactory used to resolve parameter values for annotated handlers in the
snapshot aggregate this snapshotter creates. |
SpringAggregateSnapshotter.Builder |
repositoryProvider(RepositoryProvider repositoryProvider)
Sets the
RepositoryProvider provided to the snapshot aggregates this snapshotter creates for correct
instantiation. |
SpringAggregateSnapshotter.Builder |
transactionManager(TransactionManager transactionManager)
Sets the
TransactionManager used to manage the transaction around storing the snapshot. |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
aggregateFactories, aggregateFactories, buildHandlerDefinition, buildParameterResolverFactory
public SpringAggregateSnapshotter.Builder eventStore(EventStore eventStore)
AbstractSnapshotter.Builder
EventStore
instance which this AbstractSnapshotter
implementation will store
snapshots in.eventStore
in class AggregateSnapshotter.Builder
eventStore
- the EventStore
instance which this AbstractSnapshotter
implementation will
store snapshots inpublic SpringAggregateSnapshotter.Builder executor(Executor executor)
AbstractSnapshotter.Builder
Executor
which handles the actual snapshot creation process. Defaults to a
DirectExecutor
.executor
in class AggregateSnapshotter.Builder
executor
- an Executor
which handles the actual snapshot creation processpublic SpringAggregateSnapshotter.Builder transactionManager(TransactionManager transactionManager)
AbstractSnapshotter.Builder
TransactionManager
used to manage the transaction around storing the snapshot. Defaults to a
NoTransactionManager
.transactionManager
in class AggregateSnapshotter.Builder
transactionManager
- the TransactionManager
used to manage the transaction around storing the
snapshotpublic SpringAggregateSnapshotter.Builder repositoryProvider(RepositoryProvider repositoryProvider)
AggregateSnapshotter.Builder
RepositoryProvider
provided to the snapshot aggregates this snapshotter creates for correct
instantiation.repositoryProvider
in class AggregateSnapshotter.Builder
repositoryProvider
- the RepositoryProvider
provided to the snapshot aggregates this snapshotter
creates for correct instantiationpublic SpringAggregateSnapshotter.Builder parameterResolverFactory(ParameterResolverFactory parameterResolverFactory)
AggregateSnapshotter.Builder
ParameterResolverFactory
used to resolve parameter values for annotated handlers in the
snapshot aggregate this snapshotter creates.parameterResolverFactory
in class AggregateSnapshotter.Builder
parameterResolverFactory
- the ParameterResolverFactory
used to resolve parameter values for
annotated handlers in the snapshot aggregate this snapshotter createspublic SpringAggregateSnapshotter.Builder handlerDefinition(HandlerDefinition handlerDefinition)
AggregateSnapshotter.Builder
HandlerDefinition
used to create concrete handlers in the snapshot aggregate this
snapshotter creates.handlerDefinition
in class AggregateSnapshotter.Builder
handlerDefinition
- the HandlerDefinition
used to create concrete handlers in the snapshot
aggregate this snapshotter createspublic SpringAggregateSnapshotter build()
SpringAggregateSnapshotter
as specified through this Builder.build
in class AggregateSnapshotter.Builder
SpringAggregateSnapshotter
as specified through this Builderprotected void validate() throws AxonConfigurationException
validate
in class AggregateSnapshotter.Builder
AxonConfigurationException
- if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2020. All rights reserved.