Class SpringAggregateSnapshotter.Builder
java.lang.Object
org.axonframework.eventsourcing.AbstractSnapshotter.Builder
org.axonframework.eventsourcing.AggregateSnapshotter.Builder
org.axonframework.spring.eventsourcing.SpringAggregateSnapshotter.Builder
- Enclosing class:
SpringAggregateSnapshotter
Builder class to instantiate a
SpringAggregateSnapshotter. The AggregateFactory instances are
lazily retrieved by the ApplicationContext.
The Executor is defaulted to an DirectExecutor.INSTANCE, the
TransactionManager defaults to a NoTransactionManager and
the SpanFactory defaults to a NoOpSpanFactory. 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.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aSpringAggregateSnapshotteras specified through this Builder.eventStore(EventStore eventStore) Sets theEventStoreinstance which thisAbstractSnapshotterimplementation will store snapshots in.Sets theExecutorwhich handles the actual snapshot creation process.handlerDefinition(HandlerDefinition handlerDefinition) Sets theHandlerDefinitionused to create concrete handlers in the snapshot aggregate this snapshotter creates.parameterResolverFactory(ParameterResolverFactory parameterResolverFactory) Sets theParameterResolverFactoryused to resolve parameter values for annotated handlers in the snapshot aggregate this snapshotter creates.repositoryProvider(RepositoryProvider repositoryProvider) Sets theRepositoryProviderprovided to the snapshot aggregates this snapshotter creates for correct instantiation.spanFactory(SnapshotterSpanFactory spanFactory) Sets theSnapshotterSpanFactoryimplementation to use for providing tracing capabilities.spanFactory(SpanFactory spanFactory) Sets theSpanFactoryimplementation to use for providing tracing capabilities.transactionManager(TransactionManager transactionManager) Sets theTransactionManagerused to manage the transaction around storing the snapshot.protected voidvalidate()Validates whether the fields contained in this Builder are set accordingly.Methods inherited from class org.axonframework.eventsourcing.AggregateSnapshotter.Builder
aggregateFactories, aggregateFactories, buildHandlerDefinition, buildParameterResolverFactory
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
eventStore
Description copied from class:AbstractSnapshotter.BuilderSets theEventStoreinstance which thisAbstractSnapshotterimplementation will store snapshots in.- Overrides:
eventStorein classAggregateSnapshotter.Builder- Parameters:
eventStore- theEventStoreinstance which thisAbstractSnapshotterimplementation will store snapshots in- Returns:
- the current Builder instance, for fluent interfacing
-
executor
Description copied from class:AbstractSnapshotter.BuilderSets theExecutorwhich handles the actual snapshot creation process. Defaults to aDirectExecutor.- Overrides:
executorin classAggregateSnapshotter.Builder- Parameters:
executor- anExecutorwhich handles the actual snapshot creation process- Returns:
- the current Builder instance, for fluent interfacing
-
transactionManager
Description copied from class:AbstractSnapshotter.BuilderSets theTransactionManagerused to manage the transaction around storing the snapshot. Defaults to aNoTransactionManager.- Overrides:
transactionManagerin classAggregateSnapshotter.Builder- Parameters:
transactionManager- theTransactionManagerused to manage the transaction around storing the snapshot- Returns:
- the current Builder instance, for fluent interfacing
-
repositoryProvider
Description copied from class:AggregateSnapshotter.BuilderSets theRepositoryProviderprovided to the snapshot aggregates this snapshotter creates for correct instantiation.- Overrides:
repositoryProviderin classAggregateSnapshotter.Builder- Parameters:
repositoryProvider- theRepositoryProviderprovided to the snapshot aggregates this snapshotter creates for correct instantiation- Returns:
- the current Builder instance, for fluent interfacing
-
parameterResolverFactory
public SpringAggregateSnapshotter.Builder parameterResolverFactory(ParameterResolverFactory parameterResolverFactory) Description copied from class:AggregateSnapshotter.BuilderSets theParameterResolverFactoryused to resolve parameter values for annotated handlers in the snapshot aggregate this snapshotter creates.- Overrides:
parameterResolverFactoryin classAggregateSnapshotter.Builder- Parameters:
parameterResolverFactory- theParameterResolverFactoryused to resolve parameter values for annotated handlers in the snapshot aggregate this snapshotter creates- Returns:
- the current Builder instance, for fluent interfacing
-
handlerDefinition
Description copied from class:AggregateSnapshotter.BuilderSets theHandlerDefinitionused to create concrete handlers in the snapshot aggregate this snapshotter creates.- Overrides:
handlerDefinitionin classAggregateSnapshotter.Builder- Parameters:
handlerDefinition- theHandlerDefinitionused to create concrete handlers in the snapshot aggregate this snapshotter creates- Returns:
- the current Builder instance, for fluent interfacing
-
spanFactory
Description copied from class:AbstractSnapshotter.BuilderSets theSpanFactoryimplementation to use for providing tracing capabilities. Defaults to aNoOpSpanFactoryby default, which provides no tracing capabilities.- Overrides:
spanFactoryin classAbstractSnapshotter.Builder- Parameters:
spanFactory- TheSpanFactoryimplementation.- Returns:
- The current Builder instance, for fluent interfacing.
-
spanFactory
Description copied from class:AbstractSnapshotter.BuilderSets theSnapshotterSpanFactoryimplementation to use for providing tracing capabilities. Defaults to aDefaultSnapshotterSpanFactorywith aNoOpSpanFactoryby default, which provides no tracing capabilities.- Overrides:
spanFactoryin classAggregateSnapshotter.Builder- Parameters:
spanFactory- TheSpanFactoryimplementation.- Returns:
- The current Builder instance, for fluent interfacing.
-
build
Initializes aSpringAggregateSnapshotteras specified through this Builder.- Overrides:
buildin classAggregateSnapshotter.Builder- Returns:
- a
SpringAggregateSnapshotteras specified through this Builder
-
validate
Validates whether the fields contained in this Builder are set accordingly.- Overrides:
validatein classAggregateSnapshotter.Builder- Throws:
AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-