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
Constructor and Description |
---|
SpringAggregateSnapshotter(EventStore eventStore,
ParameterResolverFactory parameterResolverFactory,
Executor executor,
TransactionManager txManager)
Initializes a snapshotter.
|
SpringAggregateSnapshotter(EventStore eventStore,
ParameterResolverFactory parameterResolverFactory,
HandlerDefinition handlerDefinition,
Executor executor,
TransactionManager txManager,
RepositoryProvider repositoryProvider)
Initializes a snapshotter using the ParameterResolverFactory instances available on the classpath.
|
Modifier and Type | Method and Description |
---|---|
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, registerAggregateFactory
createSnapshotterTask, getEventStore, getExecutor, scheduleSnapshot
public SpringAggregateSnapshotter(EventStore eventStore, ParameterResolverFactory parameterResolverFactory, Executor executor, TransactionManager txManager)
eventStore
- The Event Store to store snapshots inparameterResolverFactory
- The parameterResolverFactory used to reconstruct aggregatesexecutor
- The executor that processes the snapshotting requeststxManager
- The transaction manager to manage the persistence transactions withpublic SpringAggregateSnapshotter(EventStore eventStore, ParameterResolverFactory parameterResolverFactory, HandlerDefinition handlerDefinition, Executor executor, TransactionManager txManager, RepositoryProvider repositoryProvider)
eventStore
- The Event Store to store snapshots inparameterResolverFactory
- The parameterResolverFactory used to reconstruct aggregateshandlerDefinition
- The handler definition used to create concrete handlersexecutor
- The executor that processes the snapshotting requeststxManager
- The transaction manager to manage the persistence transactions withrepositoryProvider
- Provides repositories for specific aggregate typesprotected AggregateFactory<?> getAggregateFactory(Class<?> aggregateType)
AggregateSnapshotter
aggregateType
, 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 AggregateSnapshotter
aggregateType
- 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.ApplicationContextAware
org.springframework.beans.BeansException
Copyright © 2010–2018. All rights reserved.