|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 DomainEventMessage |
createSnapshot(String typeIdentifier,
Object aggregateIdentifier,
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,
Object 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,
Object 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. |
void |
setTxManager(TransactionManager<?> transactionManager)
Sets the transactionManager that wraps the snapshot creation in a transaction. |
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, Object aggregateIdentifier)
Snapshotter
typeIdentifier
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 Snapshotter
typeIdentifier
- the type of the aggregate to take the snapshot foraggregateIdentifier
- The identifier of the aggregate to take the snapshot forprotected Runnable createSnapshotterTask(String typeIdentifier, Object aggregateIdentifier)
typeIdentifier
- The type of the aggregate to create a snapshot foraggregateIdentifier
- The identifier of the aggregate to create a snapshot for
protected abstract DomainEventMessage createSnapshot(String typeIdentifier, Object aggregateIdentifier, 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 identifieraggregateIdentifier
- The identifier of the aggregate to create a snapshot foreventStream
- The event stream containing the aggregate's past events
null
if none should be stored.public void setTxManager(TransactionManager<?> transactionManager)
transactionManager
- the transactionManager to create transactions withprotected SnapshotEventStore getEventStore()
public void setEventStore(SnapshotEventStore eventStore)
eventStore
- the event store to useprotected Executor getExecutor()
public void setExecutor(Executor executor)
executor
- the executor to execute snapshotting tasks
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |