All Known Implementing Classes:
AddNewAggregateSnapshotStrategy.AddNewSnapshotWhenBehindByNumberOfEvents

public interface AddNewAggregateSnapshotStrategy
Strategy for when an aggregate snapshot should be added
  • Method Details

    • updateWhenBehindByNumberOfEvents

      static AddNewAggregateSnapshotStrategy updateWhenBehindByNumberOfEvents(long numberOfEvents)
    • updateOnEachAggregateUpdate

      static AddNewAggregateSnapshotStrategy updateOnEachAggregateUpdate()
    • shouldANewAggregateSnapshotBeAdded

      <ID, AGGREGATE_IMPL_TYPE> boolean shouldANewAggregateSnapshotBeAdded(AGGREGATE_IMPL_TYPE aggregate, dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateEventStream<ID> persistedEvents, Optional<dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.types.EventOrder> mostRecentlyStoredSnapshotLastIncludedEventOrder)
      Should a new aggregate snapshot be added based on
      Parameters:
      aggregate - the aggregate that was just updated
      persistedEvents - the events that was just persisted in relation to the aggregate
      mostRecentlyStoredSnapshotLastIncludedEventOrder - The most recent found AggregateSnapshot.eventOrderOfLastIncludedEvent for the given Aggregate instance (may be Optional.empty())
      Returns:
      true if the aggregate snapshot should be added, otherwise false