public class SpringAggregateSnapshotter extends AggregateSnapshotter implements 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.
SpringAggregateSnapshotterFactoryBean| Modifier and Type | Class and Description |
|---|---|
static class |
SpringAggregateSnapshotter.Builder
Builder class to instantiate a
SpringAggregateSnapshotter. |
| Modifier | Constructor and Description |
|---|---|
protected |
SpringAggregateSnapshotter(SpringAggregateSnapshotter.Builder builder)
Instantiate a
SpringAggregateSnapshotter based on the fields contained in the SpringAggregateSnapshotter.Builder. |
| Modifier and Type | Method and Description |
|---|---|
static SpringAggregateSnapshotter.Builder |
builder()
Instantiate a Builder to be able to create a
SpringAggregateSnapshotter. |
protected AggregateFactory<?> |
getAggregateFactory(Class<?> aggregateType)
Returns the AggregateFactory registered for the given
aggregateType, or null if no such
AggregateFactory is known. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
createSnapshot, registerAggregateFactorycreateSnapshotterTask, getEventStore, getExecutor, scheduleSnapshotprotected SpringAggregateSnapshotter(SpringAggregateSnapshotter.Builder builder)
SpringAggregateSnapshotter based on the fields contained in the SpringAggregateSnapshotter.Builder. The
AggregateFactory instances are lazily retrieved by the ApplicationContext.
Will assert that the EventStore, ParameterResolverFactory and HandlerDefinition are not
null, and will throw an AxonConfigurationException if any of them is null.
builder - the SpringAggregateSnapshotter.Builder used to instantiate a SpringAggregateSnapshotter instancepublic static SpringAggregateSnapshotter.Builder 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.
SpringAggregateSnapshotterClasspathParameterResolverFactory,
ClasspathHandlerDefinitionprotected AggregateFactory<?> getAggregateFactory(Class<?> aggregateType)
AggregateSnapshotteraggregateType, or null if no such
AggregateFactory is known.
Sublasses may override this method to enhance how AggregateFactories are retrieved. They may choose to
AggregateSnapshotter.registerAggregateFactory(AggregateFactory) if it hasn't been found using this implementation.
getAggregateFactory in class AggregateSnapshotteraggregateType - The type to get the AggregateFactory fornull if not foundpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionCopyright © 2010–2018. All rights reserved.