Class RetentionCriteria

java.lang.Object
org.apache.pekko.persistence.typed.javadsl.RetentionCriteria
Direct Known Subclasses:
DisabledRetentionCriteria$, SnapshotCountRetentionCriteria

public abstract class RetentionCriteria extends Object
Criteria for retention/deletion of snapshots and events.
  • Constructor Details

    • RetentionCriteria

      public RetentionCriteria()
  • Method Details

    • disabled

      public static RetentionCriteria disabled()
      Snapshots are not saved and deleted automatically, events are not deleted.
    • snapshotEvery

      public static SnapshotCountRetentionCriteria snapshotEvery(int numberOfEvents, int keepNSnapshots)
      Save snapshots automatically every numberOfEvents. Snapshots that have sequence number less than the sequence number of the saved snapshot minus keepNSnapshots * numberOfEvents are automatically deleted.

      Use SnapshotCountRetentionCriteria.withDeleteEventsOnSnapshot to delete old events. Events are not deleted by default.

      If multiple events are persisted with a single Effect, the snapshot will happen after all of the events are persisted rather than precisely every numberOfEvents.

    • asScala

      public abstract RetentionCriteria asScala()