Class Recovery

java.lang.Object
org.apache.pekko.persistence.Recovery
All Implemented Interfaces:
Serializable, scala.Equals, scala.Product

public final class Recovery extends Object implements scala.Product, Serializable
Recovery mode configuration object to be returned in PersistenceRecovery.recovery().

By default recovers from latest snapshot replays through to the last available event (last sequenceId).

Recovery will start from a snapshot if the persistent actor has previously saved one or more snapshots and at least one of these snapshots matches the specified fromSnapshot criteria. Otherwise, recovery will start from scratch by replaying all stored events.

If recovery starts from a snapshot, the persistent actor is offered that snapshot with a SnapshotOffer message, followed by replayed messages, if any, that are younger than the snapshot, up to the specified upper sequence number bound (toSequenceNr).

param: fromSnapshot criteria for selecting a saved snapshot from which recovery should start. Default is latest (= youngest) snapshot. param: toSequenceNr upper sequence number bound (inclusive) for recovery. Default is no upper bound. param: replayMax maximum number of messages to replay. Default is no limit.

See Also:
  • Constructor Details

  • Method Details

    • $lessinit$greater$default$1

      public static SnapshotSelectionCriteria $lessinit$greater$default$1()
    • $lessinit$greater$default$2

      public static long $lessinit$greater$default$2()
    • $lessinit$greater$default$3

      public static long $lessinit$greater$default$3()
    • create

      public static Recovery create()
      Java API
      See Also:
    • create

      public static Recovery create(long toSequenceNr)
      Java API
      See Also:
    • create

      public static Recovery create(SnapshotSelectionCriteria fromSnapshot)
      Java API
      See Also:
    • create

      public static Recovery create(SnapshotSelectionCriteria fromSnapshot, long toSequenceNr)
      Java API
      See Also:
    • create

      public static Recovery create(SnapshotSelectionCriteria fromSnapshot, long toSequenceNr, long replayMax)
      Java API
      See Also:
    • none

      public static Recovery none()
      Convenience method for skipping recovery in PersistentActor.

      It will still retrieve previously highest sequence number so that new events are persisted with higher sequence numbers rather than starting from 1 and assuming that there are no previous event with that sequence number.

      See Also:
    • apply

      public static Recovery apply(SnapshotSelectionCriteria fromSnapshot, long toSequenceNr, long replayMax)
    • apply$default$1

      public static SnapshotSelectionCriteria apply$default$1()
    • apply$default$2

      public static long apply$default$2()
    • apply$default$3

      public static long apply$default$3()
    • unapply

      public static scala.Option<scala.Tuple3<SnapshotSelectionCriteria,Object,Object>> unapply(Recovery x$0)
    • fromSnapshot

      public SnapshotSelectionCriteria fromSnapshot()
    • toSequenceNr

      public long toSequenceNr()
    • replayMax

      public long replayMax()
    • copy

      public Recovery copy(SnapshotSelectionCriteria fromSnapshot, long toSequenceNr, long replayMax)
    • copy$default$1

      public SnapshotSelectionCriteria copy$default$1()
    • copy$default$2

      public long copy$default$2()
    • copy$default$3

      public long copy$default$3()
    • productPrefix

      public String productPrefix()
      Specified by:
      productPrefix in interface scala.Product
    • productArity

      public int productArity()
      Specified by:
      productArity in interface scala.Product
    • productElement

      public Object productElement(int x$1)
      Specified by:
      productElement in interface scala.Product
    • productIterator

      public scala.collection.Iterator<Object> productIterator()
      Specified by:
      productIterator in interface scala.Product
    • canEqual

      public boolean canEqual(Object x$1)
      Specified by:
      canEqual in interface scala.Equals
    • productElementName

      public String productElementName(int x$1)
      Specified by:
      productElementName in interface scala.Product
    • hashCode

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

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

      public boolean equals(Object x$1)
      Specified by:
      equals in interface scala.Equals
      Overrides:
      equals in class Object