|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.eventsourcing.AbstractSnapshotter
public abstract class AbstractSnapshotter
Abstract implementation of the Snapshotter that uses a task executor to
creates snapshots. Actual snapshot creation logic should be provided by a subclass.
DirectExecutor to process snapshot taking
tasks. In production environments, it is recommended to use asynchronous executors instead.
| Constructor Summary | |
|---|---|
AbstractSnapshotter()
|
|
| Method Summary | |
|---|---|
protected abstract DomainEvent |
createSnapshot(String typeIdentifier,
DomainEventStream eventStream)
Creates a snapshot event for an aggregate of the given typeIdentifier of which passed events are
available in the given eventStream. |
protected Runnable |
createSnapshotterTask(String typeIdentifier,
AggregateIdentifier aggregateIdentifier)
Creates an instance of a task that contains the actual snapshot creation logic. |
protected SnapshotEventStore |
getEventStore()
Returns the event store this snapshotter uses to load domain events and store snapshot events. |
protected Executor |
getExecutor()
Returns the executor that executes snapshot taking tasks. |
void |
scheduleSnapshot(String typeIdentifier,
AggregateIdentifier aggregateIdentifier)
Schedules snapshot taking for an aggregate with given typeIdentifier and
aggregateIdentifier. |
void |
setEventStore(SnapshotEventStore eventStore)
Sets the event store where the snapshotter can load domain events and store its snapshot events. |
void |
setExecutor(Executor executor)
Sets the executor that should process actual snapshot taking. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractSnapshotter()
| Method Detail |
|---|
public void scheduleSnapshot(String typeIdentifier,
AggregateIdentifier aggregateIdentifier)
SnapshottertypeIdentifier and
aggregateIdentifier. The implementation may choose to process this call synchronously (i.e. in the
caller's thread), asynchronously, or ignore the call altogether.
scheduleSnapshot in interface SnapshottertypeIdentifier - the type of the aggregate to take the snapshot foraggregateIdentifier - The identifier of the aggregate to take the snapshot for
protected Runnable createSnapshotterTask(String typeIdentifier,
AggregateIdentifier aggregateIdentifier)
typeIdentifier - The type of the aggregate to create a snapshot foraggregateIdentifier - The identifier of the aggregate to create a snapshot for
protected abstract DomainEvent createSnapshot(String typeIdentifier,
DomainEventStream eventStream)
typeIdentifier of which passed events are
available in the given eventStream. May return null to indicate a snapshot event is not
necessary or appropriate for the given event stream.
typeIdentifier - The aggregate's type identifiereventStream - The event stream containing the aggregate's past events
null if none should be stored.public void setEventStore(SnapshotEventStore eventStore)
eventStore - the event store to usepublic void setExecutor(Executor executor)
executor - the executor to execute snapshotting tasksprotected SnapshotEventStore getEventStore()
protected Executor getExecutor()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||