public class AggregateSnapshotter extends AbstractSnapshotter
| Constructor and Description | 
|---|
AggregateSnapshotter(EventStore eventStore,
                    AggregateFactory<?>... aggregateFactories)
Initializes a snapshotter using the ParameterResolverFactory instances available on the classpath. 
 | 
AggregateSnapshotter(EventStore eventStore,
                    List<AggregateFactory<?>> aggregateFactories)
Initializes a snapshotter using the ParameterResolverFactory instances available on the classpath. 
 | 
AggregateSnapshotter(EventStore eventStore,
                    List<AggregateFactory<?>> aggregateFactories,
                    ParameterResolverFactory parameterResolverFactory)
Initializes a snapshotter using the given  
parameterResolverFactory. | 
AggregateSnapshotter(EventStore eventStore,
                    List<AggregateFactory<?>> aggregateFactories,
                    ParameterResolverFactory parameterResolverFactory,
                    Executor executor,
                    TransactionManager transactionManager)
Initializes a snapshotter that stores snapshots using the given  
executor. | 
| Modifier and Type | Method and Description | 
|---|---|
protected DomainEventMessage | 
createSnapshot(Class<?> aggregateType,
              String aggregateIdentifier,
              DomainEventStream eventStream)
Creates a snapshot event for an aggregate of which passed events are available in the given  
eventStream. | 
protected AggregateFactory<?> | 
getAggregateFactory(Class<?> aggregateType)
Returns the AggregateFactory registered for the given  
aggregateType, or null if no such
 AggregateFactory is known. | 
protected void | 
registerAggregateFactory(AggregateFactory<?> aggregateFactory)
Registers the given  
aggregateFactory with this snapshotter. | 
createSnapshotterTask, getEventStore, getExecutor, scheduleSnapshotpublic AggregateSnapshotter(EventStore eventStore, AggregateFactory<?>... aggregateFactories)
aggregateFactories are used to instantiate the relevant Aggregate Root instances,
 which represent the snapshots.eventStore - The Event Store to store snapshots inaggregateFactories - The factories for the aggregates supported by this snapshotter.ClasspathParameterResolverFactorypublic AggregateSnapshotter(EventStore eventStore, List<AggregateFactory<?>> aggregateFactories)
aggregateFactories are used to instantiate the relevant Aggregate Root instances,
 which represent the snapshots.eventStore - The Event Store to store snapshots inaggregateFactories - The factories for the aggregates supported by this snapshotter.ClasspathParameterResolverFactorypublic AggregateSnapshotter(EventStore eventStore, List<AggregateFactory<?>> aggregateFactories, ParameterResolverFactory parameterResolverFactory)
parameterResolverFactory. The given aggregateFactories
 are used to instantiate the relevant Aggregate Root instances, which represent the snapshots. Snapshots are
 stores in the given eventStore.eventStore - The Event Store to store snapshots inaggregateFactories - The factories for the aggregates supported by this snapshotter.parameterResolverFactory - The ParameterResolverFactory instance to resolve parameter values for annotated
                                 handlers withpublic AggregateSnapshotter(EventStore eventStore, List<AggregateFactory<?>> aggregateFactories, ParameterResolverFactory parameterResolverFactory, Executor executor, TransactionManager transactionManager)
executor.eventStore - The Event Store to store snapshots inaggregateFactories - The factories for the aggregates supported by this snapshotter.parameterResolverFactory - The ParameterResolverFactory instance to resolve parameter values for annotated
                                 handlers withexecutor - The executor to process the actual snapshot creation withtransactionManager - The transaction manager to handle the transactions around the snapshot creation
                                 process withprotected DomainEventMessage createSnapshot(Class<?> aggregateType, String aggregateIdentifier, DomainEventStream eventStream)
AbstractSnapshottereventStream.
 May return null to indicate a snapshot event is not necessary or appropriate for the given event stream.createSnapshot in class AbstractSnapshotteraggregateType - The aggregate's type identifieraggregateIdentifier - The identifier of the aggregate to create a snapshot foreventStream - The event stream containing the aggregate's past eventsnull if none should be stored.protected AggregateFactory<?> getAggregateFactory(Class<?> aggregateType)
aggregateType, or null if no such
 AggregateFactory is known.
 
 Sublasses may override this method to enhance how AggregateFactories are retrieved. They may choose to
 registerAggregateFactory(AggregateFactory) if it hasn't been found using this implementation.
aggregateType - The type to get the AggregateFactory fornull if not foundprotected void registerAggregateFactory(AggregateFactory<?> aggregateFactory)
aggregateFactory with this snapshotter. If a factory for this type was already
 registered, it is overwritten with this one.aggregateFactory - the AggregateFactory to registerCopyright © 2010–2018. All rights reserved.