Class AddNewAggregateSnapshotStrategy.AddNewSnapshotWhenBehindByNumberOfEvents

java.lang.Object
dk.cloudcreate.essentials.components.eventsourced.aggregates.snapshot.AddNewAggregateSnapshotStrategy.AddNewSnapshotWhenBehindByNumberOfEvents
All Implemented Interfaces:
AddNewAggregateSnapshotStrategy
Enclosing interface:
AddNewAggregateSnapshotStrategy

public static class AddNewAggregateSnapshotStrategy.AddNewSnapshotWhenBehindByNumberOfEvents extends Object implements AddNewAggregateSnapshotStrategy
  • Constructor Details

    • AddNewSnapshotWhenBehindByNumberOfEvents

      public AddNewSnapshotWhenBehindByNumberOfEvents(long numberOfEventsBetweenAddingANewSnapshot)
  • Method Details

    • getNumberOfEventsBetweenAddingANewSnapshot

      public long getNumberOfEventsBetweenAddingANewSnapshot()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • shouldANewAggregateSnapshotBeAdded

      public <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)
      Description copied from interface: AddNewAggregateSnapshotStrategy
      Should a new aggregate snapshot be added based on
      Specified by:
      shouldANewAggregateSnapshotBeAdded in interface AddNewAggregateSnapshotStrategy
      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