Class PersistentFSMBase<TState, TData, TEvent>
TBD
Inheritance
Implements
Inherited Members
Namespace: Akka.Persistence.Fsm
Assembly: Akka.Persistence.dll
Syntax
public abstract class PersistentFSMBase<TState, TData, TEvent> : PersistentActor, IInternalActor, IPersistentIdentity, IPersistenceStash, IWithUnboundedStash, IWithUnrestrictedStash, IActorStash, IRequiresMessageQueue<IUnboundedDequeBasedMessageQueueSemantics>, IPersistenceRecovery, IListeners
Type Parameters
Name | Description |
---|---|
TState | TBD |
TData | TBD |
TEvent | TBD |
Constructors
| Improve this Doc View SourcePersistentFSMBase()
Initializes a new instance of the PersistentFSMBase<TState, TData, TEvent> class.
Declaration
protected PersistentFSMBase()
Properties
| Improve this Doc View SourceListeners
Listener support
Declaration
public ListenerSupport Listeners { get; }
Property Value
Type | Description |
---|---|
ListenerSupport |
NextStateData
Return next state data (available in OnTransition(PersistentFSMBase<TState, TData, TEvent>.TransitionHandler) handlers)
Declaration
public TData NextStateData { get; }
Property Value
Type | Description |
---|---|
TData |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception is thrown if this property is accessed outside of an OnTransition(PersistentFSMBase<TState, TData, TEvent>.TransitionHandler) handler. |
StateData
Current state data
Declaration
public TData StateData { get; }
Property Value
Type | Description |
---|---|
TData |
Exceptions
Type | Condition |
---|---|
IllegalStateException | This exception is thrown if this property is accessed before StartWith(TState, TData, Nullable<TimeSpan>) was called. |
StateName
Current state name
Declaration
public TState StateName { get; }
Property Value
Type | Description |
---|---|
TState |
Exceptions
Type | Condition |
---|---|
IllegalStateException | This exception is thrown if this property is accessed before StartWith(TState, TData, Nullable<TimeSpan>) was called. |
StateNames
Return all defined state names
Declaration
protected IEnumerable<TState> StateNames { get; }
Property Value
Type | Description |
---|---|
IEnumerable<TState> |
Methods
| Improve this Doc View SourceApplyState(PersistentFSM.State<TState, TData, TEvent>)
TBD
Declaration
protected virtual void ApplyState(PersistentFSM.State<TState, TData, TEvent> nextState)
Parameters
Type | Name | Description |
---|---|---|
PersistentFSM.State<TState, TData, TEvent> | nextState | TBD |
CancelTimer(String)
Cancel a named Akka.Actor.FSMBase.Timer, ensuring that the message is not subsequently delivered (no race.)
Declaration
public void CancelTimer(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the timer to cancel. |
GoTo(TState)
Produce transition to other state. Return this from a state function in order to effect the transition.
Declaration
public PersistentFSM.State<TState, TData, TEvent> GoTo(TState nextStateName)
Parameters
Type | Name | Description |
---|---|---|
TState | nextStateName | State designator for the next state |
Returns
Type | Description |
---|---|
PersistentFSM.State<TState, TData, TEvent> | State transition descriptor |
IsTimerActive(String)
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.
Declaration
public bool IsTimerActive(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | TBD |
Returns
Type | Description |
---|---|
Boolean | TBD |
LogTermination(FSMBase.Reason)
By default, Failure is logged at error level and other reason types are not logged. It is possible to override this behavior.
Declaration
protected virtual void LogTermination(FSMBase.Reason reason)
Parameters
Type | Name | Description |
---|---|---|
FSMBase.Reason | reason | TBD |
OnTermination(Action<FSMBase.StopEvent<TState, TData>>)
Set the handler which is called upon termination of this FSM actor. Calling this method again will overwrite the previous contents.
Declaration
public void OnTermination(Action<FSMBase.StopEvent<TState, TData>> terminationHandler)
Parameters
Type | Name | Description |
---|---|---|
Action<FSMBase.StopEvent<TState, TData>> | terminationHandler | TBD |
OnTransition(PersistentFSMBase<TState, TData, TEvent>.TransitionHandler)
Set handler which is called upon each state transition
Declaration
public void OnTransition(PersistentFSMBase<TState, TData, TEvent>.TransitionHandler transitionHandler)
Parameters
Type | Name | Description |
---|---|---|
PersistentFSMBase.TransitionHandler<> | transitionHandler | TBD |
PostStop()
Call the OnTermination(Action<FSMBase.StopEvent<TState, 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(Action<FSMBase.StopEvent<TState, TData>>) shall not be called during restart.
Declaration
protected override void PostStop()
Overrides
| Improve this Doc View SourceReceiveCommand(Object)
Command handler. Typically validates commands against current state - possibly by communicating with other actors. On successful validation, one or more events are derived from command and persisted.
Declaration
protected override bool ReceiveCommand(object message)
Parameters
Type | Name | Description |
---|---|---|
Object | message | TBD |
Returns
Type | Description |
---|---|
Boolean | TBD |
Overrides
| Improve this Doc View SourceSetStateTimeout(TState, Nullable<TimeSpan>)
Set the state timeout explicitly. This method can be safely used from within a state handler.
Declaration
public void SetStateTimeout(TState state, TimeSpan? timeout)
Parameters
Type | Name | Description |
---|---|---|
TState | state | TBD |
Nullable<TimeSpan> | timeout | TBD |
SetTimer(String, Object, TimeSpan, Boolean)
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.
Declaration
public void SetTimer(string name, object msg, TimeSpan timeout, bool repeat = false)
Parameters
Type | Name | Description |
---|---|---|
String | name | identifier to be used with CancelTimer(String). |
Object | msg | message to be delivered |
TimeSpan | timeout | delay of first message delivery and between subsequent messages. |
Boolean | repeat | send once if false, scheduleAtFixedRate if true |
StartWith(TState, TData, Nullable<TimeSpan>)
Sets the initial state for this FSM. Call this method from the constructor before the Akka.Persistence.Fsm.PersistentFSMBase`3.Initialize method. If different state is needed after a restart this method, followed by Akka.Persistence.Fsm.PersistentFSMBase`3.Initialize, can be used in the actor life cycle hooks PreStart() and PostRestart(Exception).
Declaration
public void StartWith(TState stateName, TData stateData, TimeSpan? timeout = null)
Parameters
Type | Name | Description |
---|---|---|
TState | stateName | Initial state designator. |
TData | stateData | Initial state data. |
Nullable<TimeSpan> | timeout | State timeout for the initial state, overriding the default timeout for that state. |
Stay()
Produce "empty" transition descriptor. Return this from a state function when no state change is to be effected.
Declaration
public PersistentFSM.State<TState, TData, TEvent> Stay()
Returns
Type | Description |
---|---|
PersistentFSM.State<TState, TData, TEvent> | Descriptor for staying in the current state. |
Stop()
Produce change descriptor to stop this FSM actor with FSMBase.Reason FSMBase.Normal
Declaration
public PersistentFSM.State<TState, TData, TEvent> Stop()
Returns
Type | Description |
---|---|
PersistentFSM.State<TState, TData, TEvent> | TBD |
Stop(FSMBase.Reason)
Produce change descriptor to stop this FSM actor with the specified FSMBase.Reason.
Declaration
public PersistentFSM.State<TState, TData, TEvent> Stop(FSMBase.Reason reason)
Parameters
Type | Name | Description |
---|---|---|
FSMBase.Reason | reason | TBD |
Returns
Type | Description |
---|---|
PersistentFSM.State<TState, TData, TEvent> | TBD |
Stop(FSMBase.Reason, TData)
TBD
Declaration
public PersistentFSM.State<TState, TData, TEvent> Stop(FSMBase.Reason reason, TData stateData)
Parameters
Type | Name | Description |
---|---|---|
FSMBase.Reason | reason | TBD |
TData | stateData | TBD |
Returns
Type | Description |
---|---|
PersistentFSM.State<TState, TData, TEvent> | TBD |
Transform(PersistentFSMBase<TState, TData, TEvent>.StateFunction)
TBD
Declaration
public PersistentFSMBase<TState, TData, TEvent>.TransformHelper Transform(PersistentFSMBase<TState, TData, TEvent>.StateFunction func)
Parameters
Type | Name | Description |
---|---|---|
PersistentFSMBase.StateFunction<> | func | TBD |
Returns
Type | Description |
---|---|
PersistentFSMBase.TransformHelper<> | TBD |
When(TState, PersistentFSMBase<TState, TData, TEvent>.StateFunction, Nullable<TimeSpan>)
Insert a new PersistentFSMBase<TState, TData, TEvent>.StateFunction 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 FSMBase.StateTimeout.
Declaration
public void When(TState stateName, PersistentFSMBase<TState, TData, TEvent>.StateFunction func, TimeSpan? timeout = null)
Parameters
Type | Name | Description |
---|---|---|
TState | stateName | designator for the state |
PersistentFSMBase.StateFunction<> | func | delegate describing this state's response to input |
Nullable<TimeSpan> | timeout | default timeout for this state |
WhenUnhandled(PersistentFSMBase<TState, TData, TEvent>.StateFunction)
Set handler which is called upon reception of unhandled FSM messages. Calling this method again will overwrite the previous contents.
Declaration
public void WhenUnhandled(PersistentFSMBase<TState, TData, TEvent>.StateFunction stateFunction)
Parameters
Type | Name | Description |
---|---|---|
PersistentFSMBase.StateFunction<> | stateFunction | TBD |