Package akka.persistence
Class AbstractPersistentActor
- java.lang.Object
-
- akka.actor.AbstractActor
-
- akka.persistence.AbstractPersistentActor
-
- All Implemented Interfaces:
Actor
,Stash
,StashFactory
,StashSupport
,UnrestrictedStash
,RequiresMessageQueue<DequeBasedMessageQueueSemantics>
,AbstractPersistentActorLike
,Eventsourced
,PersistenceIdentity
,PersistenceRecovery
,PersistenceStash
,Snapshotter
- Direct Known Subclasses:
AbstractPersistentActorWithAtLeastOnceDelivery
public abstract class AbstractPersistentActor extends AbstractActor implements AbstractPersistentActorLike
Recovery handler that receives persisted events during recovery. If a state snapshot has been captured and saved, this handler will receive aSnapshotOffer
message followed by events that are younger than the offered snapshot.This handler must not have side-effects other than changing persistent actor state i.e. it should not perform actions that may fail, such as interacting with external services, for example.
If there is a problem with recovering the state of the actor from the journal, the error will be logged and the actor will be stopped.
- See Also:
Recovery
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class akka.actor.AbstractActor
AbstractActor.ActorContext, AbstractActor.Receive
-
Nested classes/interfaces inherited from interface akka.actor.Actor
Actor.emptyBehavior$, Actor.ignoringBehavior$
-
Nested classes/interfaces inherited from interface akka.persistence.Eventsourced
Eventsourced.AsyncHandlerInvocation, Eventsourced.AsyncHandlerInvocation$, Eventsourced.PendingHandlerInvocation, Eventsourced.RecoveryTick, Eventsourced.RecoveryTick$, Eventsourced.StashingHandlerInvocation, Eventsourced.StashingHandlerInvocation$, Eventsourced.State
-
-
Constructor Summary
Constructors Constructor Description AbstractPersistentActor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
akka$actor$StashSupport$_setter_$mailbox_$eq(DequeBasedMessageQueueSemantics x$1)
abstract AbstractActor.Receive
createReceive()
An persistent actor has to define its initial receive behavior by implementing thecreateReceive
method, also known as the command handler.abstract AbstractActor.Receive
createReceiveRecover()
Recovery handler that receives persisted events during recovery.protected ActorRef
journal()
DequeBasedMessageQueueSemantics
mailbox()
protected ActorRef
snapshotStore()
Snapshot store plugin actor.-
Methods inherited from class akka.actor.AbstractActor
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, context, emptyBehavior, getContext, getSelf, getSender, postRestart, postStop, preRestart, preRestart, preStart, receive, receiveBuilder, self, supervisorStrategy
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.persistence.AbstractPersistentActorLike
defer, deferAsync, persist, persistAll, persistAllAsync, persistAsync, receiveCommand, receiveRecover
-
Methods inherited from interface akka.actor.Actor
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, context, postRestart, preStart, receive, self, sender, supervisorStrategy
-
Methods inherited from interface akka.persistence.Eventsourced
_lastSequenceNr_$eq, aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, batchAtomicWrite, changeState, currentState_$eq, deleteMessages, eventBatch_$eq, flushBatch, flushJournalBatch, internalDefer, internalDeferAsync, internalDeleteMessagesBeforeSnapshot, internalPersist, internalPersistAll, internalPersistAllAsync, internalPersistAsync, journalBatch_$eq, lastSequenceNr, log, nextSequenceNr, onPersistFailure, onPersistRejected, onRecoveryFailure, onReplaySuccess, peekApplyHandler, pendingStashingPersistInvocations_$eq, recovering, recoveryFinished, recoveryRunning, recoveryStarted, requestRecoveryPermit, sendBatchedEventsToJournal, sequenceNr_$eq, setLastSequenceNr, snapshotSequenceNr, snapshotterId, startRecovery, stash, stashInternally, super$aroundPostRestart, super$aroundPostStop, super$aroundPreRestart, super$aroundPreStart, super$aroundReceive, super$stash, super$unhandled, unhandled, unstashAll, unstashInternally, updateLastSequenceNr, waitingRecoveryPermit, writeEventFailed, writeEventRejected, writeEventSucceeded, writeInProgress_$eq
-
Methods inherited from interface akka.persistence.PersistenceIdentity
journalPluginId, persistenceId, snapshotPluginId
-
Methods inherited from interface akka.persistence.PersistenceRecovery
recovery
-
Methods inherited from interface akka.persistence.PersistenceStash
internalStashOverflowStrategy
-
Methods inherited from interface akka.persistence.Snapshotter
deleteSnapshot, deleteSnapshots, loadSnapshot, saveSnapshot
-
Methods inherited from interface akka.actor.StashFactory
createStash
-
Methods inherited from interface akka.actor.StashSupport
actorCell, clearStash, context, enqueueFirst, prepend, self, theStash_$eq, unstash, unstashAll
-
Methods inherited from interface akka.actor.UnrestrictedStash
postStop, preRestart, super$postStop, super$preRestart
-
-
-
-
Method Detail
-
akka$actor$StashSupport$_setter_$mailbox_$eq
protected void akka$actor$StashSupport$_setter_$mailbox_$eq(DequeBasedMessageQueueSemantics x$1)
- Specified by:
akka$actor$StashSupport$_setter_$mailbox_$eq
in interfaceStashSupport
-
createReceive
public abstract AbstractActor.Receive createReceive()
An persistent actor has to define its initial receive behavior by implementing thecreateReceive
method, also known as the command handler. Typically validates commands against current state (and/or by communication with other actors). On successful validation, one or more events are derived from a command and these events are then persisted by callingpersist
.- Specified by:
createReceive
in interfaceAbstractPersistentActorLike
- Specified by:
createReceive
in classAbstractActor
- Returns:
- (undocumented)
-
createReceiveRecover
public abstract AbstractActor.Receive createReceiveRecover()
Description copied from interface:AbstractPersistentActorLike
Recovery handler that receives persisted events during recovery. If a state snapshot has been captured and saved, this handler will receive aSnapshotOffer
message followed by events that are younger than the offered snapshot.This handler must not have side-effects other than changing persistent actor state i.e. it should not perform actions that may fail, such as interacting with external services, for example.
If there is a problem with recovering the state of the actor from the journal, the error will be logged and the actor will be stopped.
- Specified by:
createReceiveRecover
in interfaceAbstractPersistentActorLike
- Returns:
- (undocumented)
- See Also:
Recovery
-
journal
protected ActorRef journal()
- Specified by:
journal
in interfaceEventsourced
-
mailbox
public DequeBasedMessageQueueSemantics mailbox()
- Specified by:
mailbox
in interfaceStashSupport
-
snapshotStore
protected ActorRef snapshotStore()
Description copied from interface:Snapshotter
Snapshot store plugin actor.- Specified by:
snapshotStore
in interfaceEventsourced
- Specified by:
snapshotStore
in interfaceSnapshotter
-
-