Search Results for

    Show / Hide Table of Contents

    Class PersistentFSMBase<TState, TData, TEvent>

    TBD

    Inheritance
    object
    ActorBase
    Eventsourced
    PersistentActor
    PersistentFSMBase<TState, TData, TEvent>
    PersistentFSM<TState, TData, TEvent>
    Implements
    IInternalActor
    IPersistentIdentity
    IPersistenceStash
    IWithUnboundedStash
    IWithUnrestrictedStash
    IActorStash
    IRequiresMessageQueue<IUnboundedDequeBasedMessageQueueSemantics>
    IPersistenceRecovery
    IListeners
    Inherited Members
    PersistentActor.Receive(object)
    Eventsourced.Extension
    Eventsourced.Log
    Eventsourced.PersistenceId
    Eventsourced.Recovery
    Eventsourced.InternalStashOverflowStrategy
    Eventsourced.Stash
    Eventsourced.JournalPluginId
    Eventsourced.SnapshotPluginId
    Eventsourced.Journal
    Eventsourced.SnapshotStore
    Eventsourced.SnapshotterId
    Eventsourced.IsRecovering
    Eventsourced.IsRecoveryFinished
    Eventsourced.LastSequenceNr
    Eventsourced.SnapshotSequenceNr
    Eventsourced.LoadSnapshot(string, SnapshotSelectionCriteria, long)
    Eventsourced.SaveSnapshot(object)
    Eventsourced.DeleteSnapshot(long)
    Eventsourced.DeleteSnapshots(SnapshotSelectionCriteria)
    Eventsourced.ReceiveRecover(object)
    Eventsourced.Persist<TEvent>(TEvent, Action<TEvent>)
    Eventsourced.PersistAll<TEvent>(IEnumerable<TEvent>, Action<TEvent>)
    Eventsourced.PersistAsync<TEvent>(TEvent, Action<TEvent>)
    Eventsourced.PersistAllAsync<TEvent>(IEnumerable<TEvent>, Action<TEvent>)
    Eventsourced.DeferAsync<TEvent>(TEvent, Action<TEvent>)
    Eventsourced.DeleteMessages(long)
    Eventsourced.OnReplaySuccess()
    Eventsourced.OnRecoveryFailure(Exception, object)
    Eventsourced.OnPersistFailure(Exception, object, long)
    Eventsourced.OnPersistRejected(Exception, object, long)
    Eventsourced.RunTask(Func<Task>)
    Eventsourced.UnstashFilterPredicate
    Eventsourced.AroundReceive(Receive, object)
    Eventsourced.AroundPreStart()
    Eventsourced.AroundPreRestart(Exception, object)
    Eventsourced.AroundPostRestart(Exception, object)
    Eventsourced.AroundPostStop()
    Eventsourced.Unhandled(object)
    ActorBase.Sender
    ActorBase.Self
    ActorBase.Context
    ActorBase.EmptyReceive
    ActorBase.Become(Receive)
    ActorBase.BecomeStacked(Receive)
    ActorBase.UnbecomeStacked()
    ActorBase.SetReceiveTimeout(TimeSpan?)
    ActorBase.PreStart()
    ActorBase.PreRestart(Exception, object)
    ActorBase.PostRestart(Exception)
    ActorBase.SupervisorStrategy()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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

    | Edit this page View Source

    PersistentFSMBase()

    Initializes a new instance of the PersistentFSMBase<TState, TData, TEvent> class.

    Declaration
    protected PersistentFSMBase()

    Properties

    | Edit this page View Source

    Listeners

    Listener support

    Declaration
    public ListenerSupport Listeners { get; }
    Property Value
    Type Description
    ListenerSupport
    | Edit this page View Source

    NextStateData

    Return next state data (available in OnTransition(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(TransitionHandler) handler.

    | Edit this page View Source

    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, TimeSpan?) was called.

    | Edit this page View Source

    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, TimeSpan?) was called.

    | Edit this page View Source

    StateNames

    Return all defined state names

    Declaration
    protected IEnumerable<TState> StateNames { get; }
    Property Value
    Type Description
    IEnumerable<TState>

    Methods

    | Edit this page View Source

    ApplyState(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

    | Edit this page View Source

    CancelTimer(string)

    Cancel a named 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.

    | Edit this page View Source

    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

    | Edit this page View Source

    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
    bool

    TBD

    | Edit this page View Source

    LogTermination(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

    | Edit this page View Source

    OnTermination(Action<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

    | Edit this page View Source

    OnTransition(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<TState, TData, TEvent>.TransitionHandler transitionHandler

    TBD

    | Edit this page View Source

    PostStop()

    Call the OnTermination(Action<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<StopEvent<TState, TData>>) shall not be called during restart.

    Declaration
    protected override void PostStop()
    Overrides
    ActorBase.PostStop()
    | Edit this page View Source

    ReceiveCommand(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
    bool

    TBD

    Overrides
    Eventsourced.ReceiveCommand(object)
    | Edit this page View Source

    SetStateTimeout(TState, 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

    TimeSpan? timeout

    TBD

    | Edit this page View Source

    SetTimer(string, object, TimeSpan, bool)

    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.

    bool repeat

    send once if false, scheduleAtFixedRate if true

    | Edit this page View Source

    StartWith(TState, TData, TimeSpan?)

    Sets the initial state for this FSM. Call this method from the constructor before the Akka.Persistence.Fsm.PersistentFSMBase<TState, TData, TEvent>.Initialize() method. If different state is needed after a restart this method, followed by Akka.Persistence.Fsm.PersistentFSMBase<TState, TData, TEvent>.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.

    TimeSpan? timeout

    State timeout for the initial state, overriding the default timeout for that state.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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

    | Edit this page View Source

    Stop(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

    | Edit this page View Source

    Stop(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

    | Edit this page View Source

    Transform(StateFunction)

    TBD

    Declaration
    public PersistentFSMBase<TState, TData, TEvent>.TransformHelper Transform(PersistentFSMBase<TState, TData, TEvent>.StateFunction func)
    Parameters
    Type Name Description
    PersistentFSMBase<TState, TData, TEvent>.StateFunction func

    TBD

    Returns
    Type Description
    PersistentFSMBase<TState, TData, TEvent>.TransformHelper

    TBD

    | Edit this page View Source

    When(TState, StateFunction, 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<TState, TData, TEvent>.StateFunction func

    delegate describing this state's response to input

    TimeSpan? timeout

    default timeout for this state

    | Edit this page View Source

    WhenUnhandled(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<TState, TData, TEvent>.StateFunction stateFunction

    TBD

    Implements

    IInternalActor
    IPersistentIdentity
    IPersistenceStash
    IWithUnboundedStash
    IWithUnrestrictedStash
    IActorStash
    IRequiresMessageQueue<T>
    IPersistenceRecovery
    IListeners

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET