PersistentFSMBaseTState, TData, TEvent Class |
Namespace: Akka.Persistence.Fsm
public abstract class PersistentFSMBase<TState, TData, TEvent> : PersistentActor, IListeners
The PersistentFSMBaseTState, TData, TEvent type exposes the following members.
Name | Description | |
---|---|---|
PersistentFSMBaseTState, TData, TEvent |
TBD
|
Name | Description | |
---|---|---|
Extension |
TBD
(Inherited from Eventsourced.) | |
InternalStashOverflowStrategy |
TBD
(Inherited from Eventsourced.) | |
IsRecovering |
Returns true if this persistent entity is currently recovering.
(Inherited from Eventsourced.) | |
IsRecoveryFinished |
Returns true if this persistent entity has successfully finished recovery.
(Inherited from Eventsourced.) | |
IsStateTimerActive |
TBD
| |
Journal |
TBD
(Inherited from Eventsourced.) | |
JournalPluginId |
TBD
(Inherited from Eventsourced.) | |
LastSequenceNr |
Highest received sequence number so far or `0L` if this actor
hasn't replayed or stored any persistent events yet.
(Inherited from Eventsourced.) | |
Listeners |
TBD
| |
Log |
TBD
(Inherited from Eventsourced.) | |
NextStateData |
Return next state data (available in OnTransition(PersistentFSMBaseTState, TData, TEventTransitionHandler) handlers)
| |
PersistenceId |
Id of the persistent entity for which messages should be replayed.
(Inherited from Eventsourced.) | |
Recovery |
Called when the persistent actor is started for the first time.
The returned Recovery object defines how the actor
will recover its persistent state before handling the first incoming message.
To skip recovery completely return None.
(Inherited from Eventsourced.) | |
Self |
Gets the self ActorRef
(Inherited from ActorBase.) | |
Sender |
Gets the sending ActorRef of the current message
(Inherited from ActorBase.) | |
SnapshotPluginId |
TBD
(Inherited from Eventsourced.) | |
SnapshotSequenceNr |
Returns LastSequenceNr (Inherited from Eventsourced.) | |
SnapshotStore |
TBD
(Inherited from Eventsourced.) | |
SnapshotterId |
Returns PersistenceId.
(Inherited from Eventsourced.) | |
Stash |
TBD
(Inherited from Eventsourced.) | |
StateData |
Current state data
| |
StateName |
Current state name
|
Name | Description | |
---|---|---|
ApplyState |
TBD
| |
AroundPostRestart |
Can be overridden to intercept calls to `PostRestart`. Calls `PostRestart` by default.
(Inherited from Eventsourced.) | |
AroundPostStop |
Can be overridden to intercept calls to `PostStop`. Calls `PostStop` by default..
(Inherited from Eventsourced.) | |
AroundPreRestart |
Can be overridden to intercept calls to `PreRestart`. Calls `PreRestart` by default.
(Inherited from Eventsourced.) | |
AroundPreStart |
Can be overridden to intercept calls to `PreStart`. Calls `PreStart` by default.
(Inherited from Eventsourced.) | |
AroundReceive |
TBD
(Inherited from Eventsourced.) | |
Become |
Changes the actor's command behavior and replaces the current receive handler with the specified handler.
(Inherited from ActorBase.) | |
BecomeStacked |
Changes the actor's behavior and replaces the current receive handler with the specified handler.
The current handler is stored on a stack, and you can revert to it by calling UnbecomeStacked (Inherited from ActorBase.)Remarks Please note, that in order to not leak memory, make sure every call to BecomeStacked(Receive)
is matched with a call to UnbecomeStacked. | |
CancelTimer |
Cancel a named Timer, ensuring that the message is not subsequently delivered (no
race.)
| |
DeferAsyncTEvent |
Defer the handler execution until all pending handlers have been executed.
Allows to define logic within the actor, which will respect the invocation-order-guarantee
in respect to PersistAsyncTEvent(TEvent, ActionTEvent) calls.
That is, if PersistAsyncTEvent(TEvent, ActionTEvent) was invoked before
DeferAsyncTEvent(TEvent, ActionTEvent), the corresponding handlers will be
invoked in the same order as they were registered in.
This call will NOT result in evt being persisted, use
PersistTEvent(TEvent, ActionTEvent) or
PersistAsyncTEvent(TEvent, ActionTEvent) instead if the given
evt should be possible to replay.
If there are no pending persist handler calls, the handler will be called immediately.
If persistence of an earlier event fails, the persistent actor will stop, and the
handler will not be run.
(Inherited from Eventsourced.) | |
DeleteMessages |
Permanently deletes all persistent messages with sequence numbers less than or equal toSequenceNr.
If the delete is successful a DeleteMessagesSuccess will be sent to the actor.
If the delete fails a DeleteMessagesFailure will be sent to the actor.
(Inherited from Eventsourced.) | |
DeleteSnapshot |
Deletes the snapshot identified by sequenceNr.
The PersistentActor will be notified about the status of the deletion
via an DeleteSnapshotSuccess or DeleteSnapshotFailure message.
(Inherited from Eventsourced.) | |
DeleteSnapshots |
Deletes all snapshots matching criteria.
The PersistentActor will be notified about the status of the deletion
via an DeleteSnapshotsSuccess or DeleteSnapshotsFailure message.
(Inherited from Eventsourced.) | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GoTo(TState) |
Produce transition to other state. Return this from a state function
in order to effect the transition.
| |
GoTo(TState, TData) |
Produce transition to other state. Return this from a state function
in order to effect the transition.
| |
Initialize | Obsolete. Verify the existence of initial state and setup timers. Used in PersistentFSMTState, TData, TEvent on recovery. An initial _currentState -> _currentState notification will be triggered by calling this method. | |
IsTimerActive |
Determines whether the named timer is still active. Returns true
unless the timer does not exist, has previously been cancelled, or
if it was a single-shot timer whose message was already received.
| |
LoadSnapshot |
Instructs the snapshot store to load the specified snapshot and send it via an
SnapshotOffer to the running PersistentActor.
(Inherited from Eventsourced.) | |
LogTermination |
By default, Failure is logged at error level and other
reason types are not logged. It is possible to override this behavior.
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnPersistFailure |
Called when persist fails. By default it logs the error.
Subclass may override to customize logging and for example send negative
acknowledgment to sender.
The actor is always stopped after this method has been invoked.
Note that the event may or may not have been saved, depending on the type of
failure.
(Inherited from Eventsourced.) | |
OnPersistRejected |
Called when the journal rejected PersistTEvent(TEvent, ActionTEvent) of an event.
The event was not stored. By default this method logs the problem as a warning, and the actor continues.
The callback handler that was passed to the PersistTEvent(TEvent, ActionTEvent)
method will not be invoked.
(Inherited from Eventsourced.) | |
OnRecoveryFailure |
Called whenever a message replay fails. By default it log the errors.
(Inherited from Eventsourced.) | |
OnReplaySuccess |
Called whenever a message replay succeeds.
(Inherited from Eventsourced.) | |
OnTermination |
Set the handler which is called upon termination of this FSM actor. Calling this
method again will overwrite the previous contents.
| |
OnTransition |
Set handler which is called upon each state transition, i.e. not when
staying in the same state.
| |
PersistTEvent |
Asynchronously persists an event. On successful persistence, the handler
is called with the persisted event. This method guarantees that no new commands will be received by a persistent actor
between a call to PersistTEvent(TEvent, ActionTEvent) and execution of it's handler. It also
holds multiple persist calls per received command. Internally this is done by stashing. The stash used
for that is an internal stash which doesn't interfere with the inherited user stash.
An event handler may close over eventsourced actor state and modify it. Sender of the persistent event
is considered a sender of the corresponding command. That means one can respond to sender from within an event handler.
Within an event handler, applications usually update persistent actor state using
persisted event data, notify listeners and reply to command senders.
If persistence of an event fails, OnPersistFailure(Exception, Object, Int64) will be invoked and the actor will
unconditionally be stopped. The reason that it cannot resume when persist fails is that it
is unknown if the event was actually persisted or not, and therefore it is in an inconsistent
state. Restarting on persistent failures will most likely fail anyway, since the journal
is probably unavailable. It is better to stop the actor and after a back-off timeout start
it again.
(Inherited from Eventsourced.) | |
PersistAllTEvent |
Asynchronously persists series of events in specified order.
This is equivalent of multiple calls of PersistTEvent(TEvent, ActionTEvent) calls
with the same handler, except that events are persisted atomically with this method.
(Inherited from Eventsourced.) | |
PersistAllAsyncTEvent |
Asynchronously persists series of events in specified order.
This is equivalent of multiple calls of PersistAsyncTEvent(TEvent, ActionTEvent) calls
with the same handler, except that events are persisted atomically with this method.
(Inherited from Eventsourced.) | |
PersistAsyncTEvent |
Asynchronously persists an event. On successful persistence, the handler
is called with the persisted event. Unlike PersistTEvent(TEvent, ActionTEvent) method,
this one will continue to receive incoming commands between calls and executing it's event handler.
This version should be used in favor of PersistTEvent(TEvent, ActionTEvent)
method when throughput is more important that commands execution precedence.
An event handler may close over eventsourced actor state and modify it. Sender of the persistent event
is considered a sender of the corresponding command. That means, one can respond to sender from within an event handler.
Within an event handler, applications usually update persistent actor state using
persisted event data, notify listeners and reply to command senders.
If persistence of an event fails, OnPersistFailure(Exception, Object, Int64) will be invoked and the actor will
unconditionally be stopped. The reason that it cannot resume when persist fails is that it
is unknown if the event was actually persisted or not, and therefore it is in an inconsistent
state. Restarting on persistent failures will most likely fail anyway, since the journal
is probably unavailable. It is better to stop the actor and after a back-off timeout start
it again.
(Inherited from Eventsourced.) | |
PostRestart |
User overridable callback: By default it calls `PreStart()`.
Is called right AFTER restart on the newly created Actor to allow reinitialization after an Actor crash.
(Inherited from ActorBase.) | |
PostStop |
Call the OnTermination(ActionFSMBaseStopEventTState, TData) hook if you want to retain this behavior.
When overriding make sure to call base.PostStop();
Please note that this method is called by default from PreRestart(Exception, Object) so
override that one if OnTermination(ActionFSMBaseStopEventTState, TData) shall not be called during restart.
(Overrides ActorBasePostStop.) | |
PreRestart |
User overridable callback: '''By default it disposes of all children and then calls `postStop()`.'''
Is called on a crashed Actor right BEFORE it is restarted to allow clean
up of resources before Actor is terminated.
(Inherited from ActorBase.) | |
PreStart |
User overridable callback.
Is called when an Actor is started.
Actors are automatically started asynchronously when created.
Empty default implementation.
(Inherited from ActorBase.) | |
ProcessMsg |
TBD
| |
Receive |
Processor for user defined messages.
(Inherited from PersistentActor.) | |
ReceiveCommand |
TBD
(Overrides EventsourcedReceiveCommand(Object).) | |
ReceiveRecover |
Recovery handler that receives persistent events during recovery. If a state snapshot has been captured and saved,
this handler will receive a SnapshotOffer message followed by events that are younger than offer itself.
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.
(Inherited from Eventsourced.) | |
SaveSnapshot |
Saves snapshot of current ISnapshotter state.
The PersistentActor will be notified about the success or failure of this
via an SaveSnapshotSuccess or SaveSnapshotFailure message.
(Inherited from Eventsourced.) | |
SetReceiveTimeout | Defines the inactivity timeout after which the sending of a ReceiveTimeout message is triggered. When specified, the receive function should be able to handle a ReceiveTimeout message. Please note that the receive timeout might fire and enqueue the ReceiveTimeout message right after another message was enqueued; hence it is not guaranteed that upon reception of the receive timeout there must have been an idle period beforehand as configured via this method. Once set, the receive timeout stays in effect (i.e. continues firing repeatedly after inactivity periods). Pass in null to switch off this feature. | |
SetStateTimeout |
Set the state timeout explicitly. This method can be safely used from
within a state handler.
| |
SetTimer |
Schedule named timer to deliver message after given delay, possibly repeating.
Any existing timer with the same name will automatically be canceled before adding
the new timer.
| |
StartWith |
Sets the initial state for this FSM. Call this method from the constructor before the Initialize
method.
If different state is needed after a restart this method, followed by Initialize, can be used in the
actor
life cycle hooks PreStart and PostRestart(Exception).
| |
Stay |
Produce "empty" transition descriptor. Return this from a state function
when no state change is to be effected.
| |
Stop |
Produce change descriptor to stop this FSM actor with FSMBaseReasonFSMBaseNormal | |
Stop(FSMBaseReason) |
Produce change descriptor to stop this FSM actor with the specified FSMBaseReason.
| |
Stop(FSMBaseReason, TData) |
TBD
| |
SupervisorStrategy |
TBD
(Inherited from ActorBase.) | |
Terminate |
TBD
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Transform |
TBD
| |
UnbecomeStacked |
Reverts the Actor behavior to the previous one on the behavior stack.
(Inherited from ActorBase.) | |
Unhandled |
Is called when a message isn't handled by the current behavior of the actor
by default it fails with either a DeathPactException (in
case of an unhandled Terminated message) or publishes an UnhandledMessage
to the actor's system's EventStream (Inherited from Eventsourced.) | |
When |
Insert a new PersistentFSMBaseTState, TData, TEventStateFunction at the end of the processing chain for the
given state. If the stateTimeout parameter is set, entering this state without a
differing explicit timeout setting will trigger a FSMBaseStateTimeout.
| |
WhenUnhandled |
Set handler which is called upon reception of unhandled FSM messages. Calling
this method again will overwrite the previous contents.
|
Name | Description | |
---|---|---|
_currentState |
FSM state data and current timeout handling
| |
_generation |
TBD
| |
_listener |
TBD
| |
_timeoutFuture |
TBD
| |
_timers |
Timer handling
| |
DebugEvent |
Can be set to enable debugging on certain actions taken by the FSM
|
Name | Description | |
---|---|---|
AsInstanceOfT |
TBD
(Defined by Extensions.) | |
Match | Overloaded.
Matches the specified target.
(Defined by PatternMatch.) | |
MatchT | Overloaded.
Matches the specified target and return a result of target processing.
(Defined by PatternMatch.) |