Interface Snapshotter<I,E>
- Type Parameters:
I- the type of the entity identifierE- the type of the entity being snapshotted
- All Known Implementing Classes:
StoreBackedSnapshotter
A
Snapshotter is responsible for loading and storing snapshots of event-sourced entities.- Since:
- 5.1.0
- Author:
- John Hendrikx
-
Method Summary
-
Method Details
-
load
Asynchronously retrieves the snapshot for the givenidentifier, if one exists.The returned
CompletableFuturecompletes with the snapshot, ornullif none exists or the snapshot cannot be used. It may complete exceptionally if snapshot retrieval fails.- Parameters:
identifier- the identifier of the entity, cannot benull- Returns:
- a
CompletableFuturethat completes with the entity's snapshot ornull - Throws:
NullPointerException- ifidentifierisnull
-
store
Stores the given entity as a snapshot asynchronously.- Parameters:
identifier- the identifier of the entity, cannot benullentity- the entity state, cannot benullposition- the position in the event stream for this entity state, cannot benull- Throws:
NullPointerException- if any argument isnull
-