public class AggregateSnapshotter extends AbstractSnapshotter
|Modifier and Type||Class and Description|
Builder class to instantiate a
|Modifier||Constructor and Description|
|Modifier and Type||Method and Description|
Instantiate a Builder to be able to create a
Creates a snapshot event for an aggregate of which passed events are available in the given
Returns the AggregateFactory registered for the given
Registers the given
createSnapshotterTask, getEventStore, getExecutor, scheduleSnapshot
protected AggregateSnapshotter(AggregateSnapshotter.Builder builder)
AggregateSnapshotterbased on the fields contained in the
Will assert that the
HandlerDefinition are not
null, and will throw an
AxonConfigurationException if any of them is
SpanFactory is defaulted to a
public static AggregateSnapshotter.Builder builder()
Executor is defaulted to an
DirectExecutor.INSTANCE and the
TransactionManager defaults to a
Additionally, this Builder has convenience functions to default the
HandlerDefinition based on instances of these available on the classpath in case these are not provided
instantiation of a
AggregateSnapshotter, it is recommended to use these function to set those fields.
EventStore is a hard requirement and as such should be provided.
protected DomainEventMessage createSnapshot(Class<?> aggregateType, String aggregateIdentifier, DomainEventStream eventStream)
eventStream. May return
nullto indicate a snapshot event is not necessary or appropriate for the given event stream.
aggregateType- The aggregate's type identifier
aggregateIdentifier- The identifier of the aggregate to create a snapshot for
eventStream- The event stream containing the aggregate's past events
nullif none should be stored.
protected AggregateFactory<?> getAggregateFactory(Class<?> aggregateType)
nullif no such AggregateFactory is known.
Subclasses 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 for
nullif not found
protected void registerAggregateFactory(AggregateFactory<?> aggregateFactory)
aggregateFactorywith this snapshotter. If a factory for this type was already registered, it is overwritten with this one.
aggregateFactory- the AggregateFactory to register
Copyright © 2010–2023. All rights reserved.