Class SpringAggregateSnapshotter
- All Implemented Interfaces:
org.axonframework.eventsourcing.Snapshotter,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
AggregateSnapshotter, this implementation lazily retrieves AggregateFactories from the Application
Context when snapshot requests are made.
Instead of configuring directly, consider using the SpringAggregateSnapshotterFactoryBean, which
configures this class using values available in the application context.
- Since:
- 3.0
- Author:
- Allard Buijze
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class to instantiate aSpringAggregateSnapshotter. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiate aSpringAggregateSnapshotterbased on the fields contained in theSpringAggregateSnapshotter.Builder. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Instantiate a Builder to be able to create aSpringAggregateSnapshotter.protected org.axonframework.eventsourcing.AggregateFactory<?>getAggregateFactory(Class<?> aggregateType) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) Methods inherited from class org.axonframework.eventsourcing.AggregateSnapshotter
createSnapshot, registerAggregateFactoryMethods inherited from class org.axonframework.eventsourcing.AbstractSnapshotter
createSnapshotterTask, getEventStore, getExecutor, scheduleSnapshot
-
Constructor Details
-
SpringAggregateSnapshotter
Instantiate aSpringAggregateSnapshotterbased on the fields contained in theSpringAggregateSnapshotter.Builder. TheAggregateFactoryinstances are lazily retrieved by theApplicationContext.Will assert that the
EventStore,ParameterResolverFactoryandHandlerDefinitionare notnull, and will throw anAxonConfigurationExceptionif any of them isnull.- Parameters:
builder- theSpringAggregateSnapshotter.Builderused to instantiate aSpringAggregateSnapshotterinstance
-
-
Method Details
-
builder
Instantiate a Builder to be able to create aSpringAggregateSnapshotter. TheAggregateFactoryinstances are lazily retrieved by theApplicationContext.The
Executoris defaulted to anDirectExecutor.INSTANCE, theTransactionManagerdefaults to aNoTransactionManagerand theSpanFactorydefaults to aNoOpSpanFactory. Additionally, this Builder has convenience functions to default theParameterResolverFactoryandHandlerDefinitionbased on instances of these available on the classpath in case these are not provided (respectivelyAggregateSnapshotter.Builder.buildParameterResolverFactory()andAggregateSnapshotter.Builder.buildHandlerDefinition()). Upon instantiation of aAggregateSnapshotter, it is recommended to use these function to set those fields.The
EventStoreis a hard requirement and as such should be provided.- Returns:
- a Builder to be able to create a
SpringAggregateSnapshotter - See Also:
-
ClasspathParameterResolverFactoryClasspathHandlerDefinition
-
getAggregateFactory
protected org.axonframework.eventsourcing.AggregateFactory<?> getAggregateFactory(Class<?> aggregateType) - Overrides:
getAggregateFactoryin classorg.axonframework.eventsourcing.AggregateSnapshotter
-
setApplicationContext
public void setApplicationContext(@Nonnull org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-