Interface DomainEventSequenceAware

All Known Subinterfaces:
EventStore
All Known Implementing Classes:
AbstractEventStore, AxonServerEventStore, EmbeddedEventStore, EmbeddedEventStore

public interface DomainEventSequenceAware
Contract describing a component which is aware of DomainEventMessage their sequences and is capable of providing the last known sequence number for a given Aggregate identifier.
Since:
4.0
Author:
Steven van Beelen
  • Method Summary

    Modifier and Type
    Method
    Description
    lastSequenceNumberFor(String aggregateIdentifier)
    Returns the last known sequence number of an Event for the given aggregateIdentifier.
  • Method Details

    • lastSequenceNumberFor

      Optional<Long> lastSequenceNumberFor(String aggregateIdentifier)
      Returns the last known sequence number of an Event for the given aggregateIdentifier.

      It is preferred to retrieve the last known sequence number from the Domain Event Stream when sourcing an Aggregate from events. However, this method provides an alternative in cases no events have been read. For example when using state storage.

      Parameters:
      aggregateIdentifier - the identifier of the aggregate to find the highest sequence for
      Returns:
      an optional containing the highest sequence number found, or an empty optional is no events are found for this aggregate