org.apache.pekko.persistence

Members list

Type members

Classlikes

abstract class AbstractPersistentActor extends AbstractActor

Java API: an persistent actor - can be used to implement command or Event Sourcing.

Java API: an persistent actor - can be used to implement command or Event Sourcing.

Attributes

Source
PersistentActor.scala
Supertypes
trait Stash
trait Snapshotter
trait Actor
class Object
trait Matchable
class Any
Show all
Known subtypes

Java API: compatible with lambda expressions

Java API: compatible with lambda expressions

Use this class instead of AbstractPersistentActor to send messages with at-least-once delivery semantics to destinations. Full documentation in AtLeastOnceDelivery.

Attributes

See also
Source
AtLeastOnceDelivery.scala
Supertypes

Attributes

Source
PersistentActor.scala
Supertypes
trait Stash
trait Snapshotter
trait Timers
trait Actor
class Object
trait Matchable
class Any
Show all

Attributes

Companion
trait
Source
AtLeastOnceDelivery.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Scala API: Mix-in this trait with your PersistentActor to send messages with at-least-once delivery semantics to destinations. It takes care of re-sending messages when they have not been confirmed within a configurable timeout. Use the AtLeastOnceDeliveryLike#deliver method to send a message to a destination. Call the AtLeastOnceDeliveryLike#confirmDelivery method when the destination has replied with a confirmation message.

Scala API: Mix-in this trait with your PersistentActor to send messages with at-least-once delivery semantics to destinations. It takes care of re-sending messages when they have not been confirmed within a configurable timeout. Use the AtLeastOnceDeliveryLike#deliver method to send a message to a destination. Call the AtLeastOnceDeliveryLike#confirmDelivery method when the destination has replied with a confirmation message.

At-least-once delivery implies that original message send order is not always retained and the destination may receive duplicate messages due to possible resends.

The interval between redelivery attempts can be defined by AtLeastOnceDeliveryLike#redeliverInterval. After a number of delivery attempts a AtLeastOnceDelivery.UnconfirmedWarning message will be sent to self. The re-sending will still continue, but you can choose to call AtLeastOnceDeliveryLike#confirmDelivery to cancel the re-sending.

The AtLeastOnceDelivery trait has a state consisting of unconfirmed messages and a sequence number. It does not store this state itself. You must persist events corresponding to the deliver and confirmDelivery invocations from your PersistentActor so that the state can be restored by calling the same methods during the recovery phase of the PersistentActor. Sometimes these events can be derived from other business level events, and sometimes you must create separate events. During recovery calls to deliver will not send out the message, but it will be sent later if no matching confirmDelivery was performed.

Support for snapshots is provided by AtLeastOnceDeliveryLike#getDeliverySnapshot and AtLeastOnceDeliveryLike#setDeliverySnapshot. The AtLeastOnceDeliverySnapshot contains the full delivery state, including unconfirmed messages. If you need a custom snapshot for other parts of the actor state you must also include the AtLeastOnceDeliverySnapshot. It is serialized using protobuf with the ordinary Akka serialization mechanism. It is easiest to include the bytes of the AtLeastOnceDeliverySnapshot as a blob in your custom snapshot.

Attributes

See also
Companion
object
Source
AtLeastOnceDelivery.scala
Supertypes
trait Stash
trait Snapshotter
trait Actor
class Object
trait Matchable
class Any
Show all
object AtomicWrite

Attributes

Companion
class
Source
Persistent.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class AtomicWrite(payload: Seq[PersistentRepr]) extends Message

Attributes

Companion
object
Source
Persistent.scala
Supertypes
trait Product
trait Equals
trait Message
trait Serializable
class Object
trait Matchable
class Any
Show all
final case class DeleteMessagesFailure(cause: Throwable, toSequenceNr: Long) extends Response

Reply message to a failed JournalProtocol.DeleteMessagesTo request.

Reply message to a failed JournalProtocol.DeleteMessagesTo request.

Attributes

Source
JournalProtocol.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Response
trait Message
trait Message
class Object
trait Matchable
class Any
Show all
final case class DeleteMessagesSuccess(toSequenceNr: Long) extends Response

Reply message to a successful JournalProtocol.DeleteMessagesTo request.

Reply message to a successful JournalProtocol.DeleteMessagesTo request.

Attributes

Source
JournalProtocol.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Response
trait Message
trait Message
class Object
trait Matchable
class Any
Show all
final case class DeleteSnapshotFailure(metadata: SnapshotMetadata, cause: Throwable) extends Response

Sent to a PersistentActor after failed deletion of a snapshot.

Sent to a PersistentActor after failed deletion of a snapshot.

Value parameters

cause

failure cause.

metadata

snapshot metadata.

Attributes

Source
SnapshotProtocol.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Response
trait Message
trait Message
class Object
trait Matchable
class Any
Show all
final case class DeleteSnapshotSuccess(metadata: SnapshotMetadata) extends Response

Sent to a PersistentActor after successful deletion of a snapshot.

Sent to a PersistentActor after successful deletion of a snapshot.

Value parameters

metadata

snapshot metadata.

Attributes

Source
SnapshotProtocol.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Response
trait Message
trait Message
class Object
trait Matchable
class Any
Show all
final case class DeleteSnapshotsFailure(criteria: SnapshotSelectionCriteria, cause: Throwable) extends Response

Sent to a PersistentActor after failed deletion of a range of snapshots.

Sent to a PersistentActor after failed deletion of a range of snapshots.

Value parameters

cause

failure cause.

criteria

snapshot selection criteria.

Attributes

Source
SnapshotProtocol.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Response
trait Message
trait Message
class Object
trait Matchable
class Any
Show all
final case class DeleteSnapshotsSuccess(criteria: SnapshotSelectionCriteria) extends Response

Sent to a PersistentActor after successful deletion of specified range of snapshots.

Sent to a PersistentActor after successful deletion of specified range of snapshots.

Value parameters

criteria

snapshot selection criteria.

Attributes

Source
SnapshotProtocol.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Response
trait Message
trait Message
class Object
trait Matchable
class Any
Show all

Attributes

Source
PersistentActor.scala
Supertypes
class Object
trait Matchable
class Any

Discard the message to pekko.actor.DeadLetter.

Discard the message to pekko.actor.DeadLetter.

Attributes

Source
PersistentActor.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type

Persistence extension provider.

Persistence extension provider.

Attributes

Companion
class
Source
Persistence.scala
Supertypes
class Object
trait Matchable
class Any
Self type
class Persistence(val system: ExtendedActorSystem) extends Extension

Persistence extension.

Persistence extension.

Attributes

Companion
object
Source
Persistence.scala
Supertypes
trait Extension
class Object
trait Matchable
class Any

Identification of PersistentActor.

Identification of PersistentActor.

Attributes

Source
Persistence.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Source
Persistence.scala
Supertypes
class Object
trait Matchable
class Any
final class PersistenceSettings(config: Config)

Persistence configuration.

Persistence configuration.

Attributes

Source
Persistence.scala
Supertypes
class Object
trait Matchable
class Any
trait PersistenceStash extends Stash

Attributes

Source
Persistence.scala
Supertypes
trait Stash
trait Actor
class Object
trait Matchable
class Any
Show all

Scala API: A persistent Actor - can be used to implement command or Event Sourcing.

Scala API: A persistent Actor - can be used to implement command or Event Sourcing.

Attributes

Source
PersistentActor.scala
Supertypes
trait Stash
trait Snapshotter
trait Actor
class Object
trait Matchable
class Any
Show all
Known subtypes
trait PersistentFSM[S, D, E]
class AbstractPersistentFSM[S, D, E]

Plugin API: representation of a persistent message in the journal plugin API.

Plugin API: representation of a persistent message in the journal plugin API.

Attributes

See also
Companion
object
Source
Persistent.scala
Supertypes
trait Message
trait Serializable
class Object
trait Matchable
class Any

Attributes

Companion
trait
Source
Persistent.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final case class Recovery(fromSnapshot: SnapshotSelectionCriteria, toSequenceNr: Long, replayMax: Long)

Recovery mode configuration object to be returned in PersistentActor#recovery.

Recovery mode configuration object to be returned in PersistentActor#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).

Value parameters

fromSnapshot

criteria for selecting a saved snapshot from which recovery should start. Default is latest (= youngest) snapshot.

replayMax

maximum number of messages to replay. Default is no limit.

toSequenceNr

upper sequence number bound (inclusive) for recovery. Default is no upper bound.

Attributes

Companion
object
Source
PersistentActor.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Recovery

Attributes

Companion
class
Source
PersistentActor.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Recovery.type
abstract class RecoveryCompleted

Attributes

Companion
object
Source
PersistentActor.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
case object RecoveryCompleted extends RecoveryCompleted

Sent to a PersistentActor when the journal replay has been finished.

Sent to a PersistentActor when the journal replay has been finished.

Attributes

Companion
class
Source
PersistentActor.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
final class RecoveryTimedOut(message: String) extends RuntimeException, NoStackTrace

Attributes

Source
PersistentActor.scala
Supertypes
trait NoStackTrace
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
final case class ReplyToStrategy(response: Any) extends StashOverflowStrategy

Reply to sender with predefined response, and discard the received message silently.

Reply to sender with predefined response, and discard the received message silently.

Value parameters

response

the message replying to sender with

Attributes

Source
PersistentActor.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Source
Persistence.scala
Supertypes
class Object
trait Matchable
class Any
final case class SaveSnapshotFailure(metadata: SnapshotMetadata, cause: Throwable) extends Response

Sent to a PersistentActor after failed saving of a snapshot.

Sent to a PersistentActor after failed saving of a snapshot.

Value parameters

cause

failure cause.

metadata

snapshot metadata.

Attributes

Source
SnapshotProtocol.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Response
trait Message
trait Message
class Object
trait Matchable
class Any
Show all
final case class SaveSnapshotSuccess(metadata: SnapshotMetadata) extends Response

Sent to a PersistentActor after successful saving of a snapshot.

Sent to a PersistentActor after successful saving of a snapshot.

Value parameters

metadata

snapshot metadata.

Attributes

Source
SnapshotProtocol.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Response
trait Message
trait Message
class Object
trait Matchable
class Any
Show all
final case class SelectedSnapshot(metadata: SnapshotMetadata, snapshot: Any)

Plugin API: a selected snapshot matching SnapshotSelectionCriteria.

Plugin API: a selected snapshot matching SnapshotSelectionCriteria.

Value parameters

metadata

snapshot metadata.

snapshot

snapshot.

Attributes

Companion
object
Source
SnapshotProtocol.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Source
SnapshotProtocol.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final class SnapshotMetadata(val persistenceId: String, val sequenceNr: Long, val timestamp: Long, val metadata: Option[Any]) extends Product3[String, Long, Long], Serializable

Snapshot metadata.

Snapshot metadata.

Value parameters

metadata

a journal can optionally support persisting metadata separate to the domain state, used for Replicated Event Sourcing support

persistenceId

id of persistent actor from which the snapshot was taken.

sequenceNr

sequence number at which the snapshot was taken.

timestamp

time at which the snapshot was saved, defaults to 0 when unknown.

Attributes

Companion
object
Source
SnapshotProtocol.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Source
SnapshotProtocol.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final case class SnapshotOffer(metadata: SnapshotMetadata, snapshot: Any)

Offers a PersistentActor a previously saved snapshot during recovery. This offer is received before any further replayed messages.

Offers a PersistentActor a previously saved snapshot during recovery. This offer is received before any further replayed messages.

Attributes

Source
SnapshotProtocol.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class SnapshotSelectionCriteria(maxSequenceNr: Long, maxTimestamp: Long, minSequenceNr: Long, minTimestamp: Long)

Selection criteria for loading and deleting snapshots.

Selection criteria for loading and deleting snapshots.

Value parameters

maxSequenceNr

upper bound for a selected snapshot's sequence number. Default is no upper bound, i.e. Long.MaxValue

maxTimestamp

upper bound for a selected snapshot's timestamp. Default is no upper bound, i.e. Long.MaxValue

minSequenceNr

lower bound for a selected snapshot's sequence number. Default is no lower bound, i.e. 0L

minTimestamp

lower bound for a selected snapshot's timestamp. Default is no lower bound, i.e. 0L

Attributes

See also
Companion
object
Source
SnapshotProtocol.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Source
SnapshotProtocol.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
trait Snapshotter extends Actor

Snapshot API on top of the internal snapshot protocol.

Snapshot API on top of the internal snapshot protocol.

Attributes

Source
Snapshotter.scala
Supertypes
trait Actor
class Object
trait Matchable
class Any
sealed trait StashOverflowStrategy

This defines how to handle the current received message which failed to stash, when the size of Stash exceeding the capacity of Stash.

This defines how to handle the current received message which failed to stash, when the size of Stash exceeding the capacity of Stash.

Attributes

Source
PersistentActor.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Implement this interface in order to configure the stashOverflowStrategy for the internal stash of persistent actor. An instance of this class must be instantiable using a no-arg constructor.

Implement this interface in order to configure the stashOverflowStrategy for the internal stash of persistent actor. An instance of this class must be instantiable using a no-arg constructor.

Attributes

Source
PersistentActor.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Source
PersistentActor.scala
Supertypes
class Object
trait Matchable
class Any

Throw pekko.actor.StashOverflowException, hence the persistent actor will starting recovery if guarded by default supervisor strategy. Be carefully if used together with persist/persistAll or has many messages needed to replay.

Throw pekko.actor.StashOverflowException, hence the persistent actor will starting recovery if guarded by default supervisor strategy. Be carefully if used together with persist/persistAll or has many messages needed to replay.

Attributes

Source
PersistentActor.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type