public interface EventStore
extends org.axonframework.eventhandling.EventBus, org.axonframework.messaging.StreamableMessageSource<org.axonframework.eventhandling.TrackedEventMessage<?>>, org.axonframework.eventhandling.DomainEventSequenceAware
| Modifier and Type | Method and Description |
|---|---|
default Optional<Long> |
lastSequenceNumberFor(String aggregateIdentifier) |
DomainEventStream |
readEvents(String aggregateIdentifier)
Open an event stream containing all domain events belonging to the given
aggregateIdentifier. |
default DomainEventStream |
readEvents(String aggregateIdentifier,
long firstSequenceNumber)
Open an event stream containing all domain events belonging to the given
aggregateIdentifier. |
void |
storeSnapshot(org.axonframework.eventhandling.DomainEventMessage<?> snapshot)
Stores the given (temporary)
snapshot event. |
DomainEventStream readEvents(@Nonnull String aggregateIdentifier)
aggregateIdentifier.
The returned stream is finite, ending with the last known event of the aggregate. If the event store holds no events of the given aggregate an empty stream is returned.
aggregateIdentifier - the identifier of the aggregate whose events to fetchdefault DomainEventStream readEvents(@Nonnull String aggregateIdentifier, long firstSequenceNumber)
aggregateIdentifier.
The returned stream is finite, ending with the last known event of the aggregate. If the event store holds no events of the given aggregate an empty stream is returned.
The default implementation invokes readEvents(String) and then filters out events with a sequence number
smaller than firstSequenceNumber.
aggregateIdentifier - the identifier of the aggregate whose events to fetchfirstSequenceNumber - the expected sequence number of the first event in the returned streamvoid storeSnapshot(@Nonnull org.axonframework.eventhandling.DomainEventMessage<?> snapshot)
snapshot event. This snapshot replaces the segment of the event stream
identified by the snapshot's Aggregate Identifier up
to (and including) the event with the snapshot's sequence
number.
These snapshots will only affect the DomainEventStream returned by the readEvents(String)
method. They do not change the events returned by StreamableMessageSource.openStream(TrackingToken) or those received
by using SubscribableMessageSource.subscribe(java.util.function.Consumer).
Note that snapshots are considered a temporary replacement for Events, and are used as performance optimization. Event Store implementations may choose to ignore or delete snapshots.
snapshot - The snapshot to replace part of the DomainEventStream.Copyright © 2010–2024. All rights reserved.