Java API: an persistent actor - can be used to implement command or event sourcing.
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.
Java API: Combination of AbstractPersistentActor and akka.actor.AbstractActorWithTimers.
Scala API: Mix-in this trait with your PersistentActor
to send messages with at-least-once
delivery semantics to destinations.
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.
AbstractPersistentActorWithAtLeastOnceDelivery for Java API
Reply message to a failed JournalProtocol.DeleteMessagesTo request.
Reply message to a successful JournalProtocol.DeleteMessagesTo request.
Sent to a PersistentActor after failed deletion of a snapshot.
Sent to a PersistentActor after failed deletion of a snapshot.
snapshot metadata.
failure cause.
Sent to a PersistentActor after successful deletion of a snapshot.
Sent to a PersistentActor after successful deletion of a snapshot.
snapshot metadata.
Sent to a PersistentActor after failed deletion of a range of snapshots.
Sent to a PersistentActor after failed deletion of a range of snapshots.
snapshot selection criteria.
failure cause.
Sent to a PersistentActor after successful deletion of specified range of snapshots.
Sent to a PersistentActor after successful deletion of specified range of snapshots.
snapshot selection criteria.
Persistence extension.
Identification of PersistentActor.
Persistence configuration.
Scala API: A persistent Actor - can be used to implement command or event sourcing.
Plugin API: representation of a persistent message in the journal plugin API.
Plugin API: representation of a persistent message in the journal plugin API.
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
).
criteria for selecting a saved snapshot from which recovery should start. Default is latest (= youngest) snapshot.
upper sequence number bound (inclusive) for recovery. Default is no upper bound.
maximum number of messages to replay. Default is no limit.
Reply to sender with predefined response, and discard the received message silently.
Reply to sender with predefined response, and discard the received message silently.
the message replying to sender with
Sent to a PersistentActor after failed saving of a snapshot.
Sent to a PersistentActor after failed saving of a snapshot.
snapshot metadata.
failure cause.
Sent to a PersistentActor after successful saving of a snapshot.
Sent to a PersistentActor after successful saving of a snapshot.
snapshot metadata.
Plugin API: a selected snapshot matching SnapshotSelectionCriteria.
Plugin API: a selected snapshot matching SnapshotSelectionCriteria.
snapshot metadata.
snapshot.
Snapshot metadata.
Snapshot metadata.
id of persistent actor from which the snapshot was taken.
sequence number at which the snapshot was taken.
time at which the snapshot was saved, defaults to 0 when unknown.
Offers a PersistentActor a previously saved snapshot
during recovery.
Offers a PersistentActor a previously saved snapshot
during recovery. This offer is received
before any further replayed messages.
Selection criteria for loading and deleting snapshots.
Selection criteria for loading and deleting snapshots.
upper bound for a selected snapshot's sequence number. Default is no upper bound,
i.e. Long.MaxValue
upper bound for a selected snapshot's timestamp. Default is no upper bound,
i.e. Long.MaxValue
lower bound for a selected snapshot's sequence number. Default is no lower bound,
i.e. 0L
lower bound for a selected snapshot's timestamp. Default is no lower bound,
i.e. 0L
Snapshot API on top of the internal snapshot protocol.
This defines how to handle the current received message which failed to stash, when the size of Stash exceeding the capacity of Stash.
Implement this interface in order to configure the stashOverflowStrategy for the internal stash of persistent actor.
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.
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.
(Since version 2.5.0) Use AbstractPersistentActor instead of UntypedPersistentActor.
Java API: Use this class instead of UntypedPersistentActor
to send messages
with at-least-once delivery semantics to destinations.
Java API: Use this class instead of UntypedPersistentActor
to send messages
with at-least-once delivery semantics to destinations.
Full documentation in AtLeastOnceDelivery.
(Since version 2.5.0) Use AbstractPersistentActorWithAtLeastOnceDelivery instead.
Discard the message to akka.actor.DeadLetter.
Persistence extension provider.
Sent to a PersistentActor when the journal replay has been finished.
Sent to a PersistentActor when the journal replay has been finished.
Throw akka.actor.StashOverflowException, hence the persistent actor will starting recovery if guarded by default supervisor strategy.
Throw akka.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.