akka.persistence
Interface Recovery

All Superinterfaces:
Actor, RequiresMessageQueue<DequeBasedMessageQueueSemantics>, Snapshotter, Stash, StashFactory, StashSupport, UnrestrictedStash
All Known Subinterfaces:
AtLeastOnceDelivery, Eventsourced, EventsourcedProcessor, PersistentActor, PersistentView, Processor, ProcessorImpl, View
All Known Implementing Classes:
AbstractEventsourcedProcessor, AbstractPersistentActor, AbstractPersistentActorWithAtLeastOnceDelivery, AbstractPersistentView, AbstractProcessor, AbstractView, JournalPerfSpec.BenchActor, RequestReader, RequestWriter, ShardCoordinator, UntypedEventsourcedProcessor, UntypedPersistentActor, UntypedPersistentActorWithAtLeastOnceDelivery, UntypedPersistentView, UntypedProcessor, UntypedView

public interface Recovery
extends Actor, Snapshotter, Stash, StashFactory

Recovery state machine that loads snapshots and replays messages.

See Also:
PersistentActor, PersistentView

Nested Class Summary
static interface Recovery.State
          INTERNAL API.
 
Nested classes/interfaces inherited from interface akka.actor.Actor
Actor.emptyBehavior$
 
Method Summary
 Persistent _currentPersistent()
           
 Recovery.State _currentState()
          INTERNAL API.
 long _lastSequenceNr()
           
 java.lang.Throwable _recoveryFailureCause()
           
 Envelope _recoveryFailureMessage()
           
 void aroundReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive, java.lang.Object message)
          INTERNAL API.
 scala.Option<Persistent> currentPersistentMessage()
          Returns the current persistent message if there is any.
 Persistence extension()
          INTERNAL API.
 Persistent getCurrentPersistentMessage()
          Java API: returns the current persistent message or null if there is none.
 ActorRef journal()
          INTERNAL API.
 long lastSequenceNr()
          Highest received sequence number so far or 0L if this actor hasn't received a persistent message yet.
 void onReplayFailure(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive, boolean awaitReplay, java.lang.Throwable cause)
          INTERNAL API.
 void onReplaySuccess(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive, boolean awaitReplay)
          INTERNAL API.
 java.lang.String persistenceId()
          Id of the persistent entity for which messages should be replayed.
 java.lang.Object prepareRestart()
          INTERNAL API.
 java.lang.String processorId()
          Id of the processor for which messages should be replayed.
 StashSupport receiverStash()
          INTERNAL API.
 java.lang.Object recoveryPending()
          INTERNAL API.
 java.lang.Object recoveryStarted(long replayMax)
          INTERNAL API.
 java.lang.Object replayFailed()
          INTERNAL API.
 java.lang.Object replayStarted(boolean await)
          INTERNAL API.
 void runReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive, Persistent msg)
          INTERNAL API.
 long snapshotSequenceNr()
          Returns lastSequenceNr.
 void updateLastSequenceNr(long value)
          INTERNAL API.
 void updateLastSequenceNr(Persistent persistent)
          INTERNAL API.
 void withCurrentPersistent(Persistent persistent, scala.Function1<Persistent,scala.runtime.BoxedUnit> body)
          INTERNAL API
 
Methods inherited from interface akka.persistence.Snapshotter
deleteSnapshot, deleteSnapshots, loadSnapshot, saveSnapshot, snapshotStore, snapshotterId
 
Methods inherited from interface akka.actor.UnrestrictedStash
postStop, preRestart
 
Methods inherited from interface akka.actor.Actor
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, context, postRestart, preStart, receive, self, sender, supervisorStrategy, unhandled
 
Methods inherited from interface akka.actor.StashSupport
actorCell, capacity, clearStash, context, enqueueFirst, mailbox, prepend, self, stash, theStash, unstash, unstashAll, unstashAll
 
Methods inherited from interface akka.actor.StashFactory
createStash
 

Method Detail

runReceive

void runReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive,
                Persistent msg)
INTERNAL API.

This is used to deliver a persistent message to the actor&rsquo;s behavior through withCurrentPersistent().

Parameters:
receive - (undocumented)
msg - (undocumented)

recoveryPending

java.lang.Object recoveryPending()
INTERNAL API.

Initial state, waits for Recover request, submit a LoadSnapshot request to the snapshot store and changes to recoveryStarted state.

Returns:
(undocumented)

recoveryStarted

java.lang.Object recoveryStarted(long replayMax)
INTERNAL API.

Processes a loaded snapshot, if any. A loaded snapshot is offered with a SnapshotOffer message to the actor's current behavior. Then initiates a message replay, either starting from the loaded snapshot or from scratch, and switches to replayStarted state.

Parameters:
replayMax - maximum number of messages to replay.
Returns:
(undocumented)

replayStarted

java.lang.Object replayStarted(boolean await)
INTERNAL API.

Processes replayed messages, if any. The actor's current behavior is invoked with the replayed Persistent messages. If processing of a replayed message fails, the exception is caught and stored for being thrown later and state is changed to recoveryFailed. If replay succeeds the onReplaySuccess method is called, otherwise onReplayFailure.

Parameters:
await - if true processing of further messages will be delayed until replay completes, otherwise, the actor's behavior is invoked immediately with these messages.
Returns:
(undocumented)

replayFailed

java.lang.Object replayFailed()
INTERNAL API.

Consumes remaining replayed messages and then changes to prepareRestart. The message that caused the exception during replay, is re-added to the mailbox and re-received in prepareRestart.

Returns:
(undocumented)

prepareRestart

java.lang.Object prepareRestart()
INTERNAL API.

Re-receives the replayed message that caused an exception and re-throws that exception.

Returns:
(undocumented)

_recoveryFailureCause

java.lang.Throwable _recoveryFailureCause()

_recoveryFailureMessage

Envelope _recoveryFailureMessage()

_lastSequenceNr

long _lastSequenceNr()

_currentPersistent

Persistent _currentPersistent()

processorId

java.lang.String processorId()
Id of the processor for which messages should be replayed.

Returns:
(undocumented)

persistenceId

java.lang.String persistenceId()
Id of the persistent entity for which messages should be replayed.

Returns:
(undocumented)

withCurrentPersistent

void withCurrentPersistent(Persistent persistent,
                           scala.Function1<Persistent,scala.runtime.BoxedUnit> body)
INTERNAL API


updateLastSequenceNr

void updateLastSequenceNr(Persistent persistent)
INTERNAL API.


updateLastSequenceNr

void updateLastSequenceNr(long value)
INTERNAL API.


currentPersistentMessage

scala.Option<Persistent> currentPersistentMessage()
Returns the current persistent message if there is any.

Returns:
(undocumented)

getCurrentPersistentMessage

Persistent getCurrentPersistentMessage()
Java API: returns the current persistent message or null if there is none.

Returns:
(undocumented)

lastSequenceNr

long lastSequenceNr()
Highest received sequence number so far or 0L if this actor hasn't received a persistent message yet. Usually equal to the sequence number of currentPersistentMessage (unless a receiver implementation is about to re-order persistent messages using stash() and unstash()).

Returns:
(undocumented)

snapshotSequenceNr

long snapshotSequenceNr()
Returns lastSequenceNr.

Specified by:
snapshotSequenceNr in interface Snapshotter
Returns:
(undocumented)

_currentState

Recovery.State _currentState()
INTERNAL API.

Returns:
(undocumented)

onReplaySuccess

void onReplaySuccess(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive,
                     boolean awaitReplay)
INTERNAL API.

Called whenever a message replay succeeds.

Parameters:
receive - the actor's current behavior.
awaitReplay - awaitReplay value of the calling replayStarted state.

onReplayFailure

void onReplayFailure(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive,
                     boolean awaitReplay,
                     java.lang.Throwable cause)
INTERNAL API.

Called whenever a message replay fails.

Parameters:
receive - the actor's current behavior.
awaitReplay - awaitReplay value of the calling replayStarted state.
cause - failure cause.

extension

Persistence extension()
INTERNAL API.

Returns:
(undocumented)

journal

ActorRef journal()
INTERNAL API.

Returns:
(undocumented)

receiverStash

StashSupport receiverStash()
INTERNAL API.

Returns:
(undocumented)

aroundReceive

void aroundReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive,
                   java.lang.Object message)
INTERNAL API.

Specified by:
aroundReceive in interface Actor
Parameters:
receive - (undocumented)
message - (undocumented)