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
-
Nested Class Summary
Nested classes/interfaces inherited from interface dk.cloudcreate.essentials.components.eventsourced.aggregates.snapshot.AddNewAggregateSnapshotStrategy
AddNewAggregateSnapshotStrategy.AddNewSnapshotWhenBehindByNumberOfEvents -
Constructor Summary
ConstructorsConstructorDescriptionAddNewSnapshotWhenBehindByNumberOfEvents(long numberOfEventsBetweenAddingANewSnapshot) -
Method Summary
Modifier and TypeMethodDescriptionbooleanlonginthashCode()<ID,AGGREGATE_IMPL_TYPE>
booleanshouldANewAggregateSnapshotBeAdded(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 ontoString()
-
Constructor Details
-
AddNewSnapshotWhenBehindByNumberOfEvents
public AddNewSnapshotWhenBehindByNumberOfEvents(long numberOfEventsBetweenAddingANewSnapshot)
-
-
Method Details
-
getNumberOfEventsBetweenAddingANewSnapshot
public long getNumberOfEventsBetweenAddingANewSnapshot() -
equals
-
hashCode
public int hashCode() -
toString
-
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:AddNewAggregateSnapshotStrategyShould a new aggregate snapshot be added based on- Specified by:
shouldANewAggregateSnapshotBeAddedin interfaceAddNewAggregateSnapshotStrategy- Parameters:
aggregate- the aggregate that was just updatedpersistedEvents- the events that was just persisted in relation to the aggregatemostRecentlyStoredSnapshotLastIncludedEventOrder- The most recent foundAggregateSnapshot.eventOrderOfLastIncludedEventfor the given Aggregate instance (may beOptional.empty())- Returns:
- true if the aggregate snapshot should be added, otherwise false
-