Class AddNewAggregateSnapshotStrategy.AddNewSnapshotWhenBehindByNumberOfEvents

    • Constructor Detail

      • AddNewSnapshotWhenBehindByNumberOfEvents

        public AddNewSnapshotWhenBehindByNumberOfEvents​(long numberOfEventsBetweenAddingANewSnapshot)
    • Method Detail

      • getNumberOfEventsBetweenAddingANewSnapshot

        public long getNumberOfEventsBetweenAddingANewSnapshot()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode 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