Interface PersistentFSMBase<S,​D,​E>

    • Method Detail

      • $minus$greater

        PersistentFSM.$minus$greater$ $minus$greater()
        This extractor is just convenience for matching a (S, S) pair, including a reminder what the new state is.
      • StateTimeout

        PersistentFSM.StateTimeout$ StateTimeout()
        This case object is received in case of a state timeout.
      • akka$persistence$fsm$PersistentFSMBase$_setter_$Event_$eq

        void akka$persistence$fsm$PersistentFSMBase$_setter_$Event_$eq​(PersistentFSM.Event$ x$1)
      • akka$persistence$fsm$PersistentFSMBase$_setter_$StateTimeout_$eq

        void akka$persistence$fsm$PersistentFSMBase$_setter_$StateTimeout_$eq​(PersistentFSM.StateTimeout$ x$1)
        This case object is received in case of a state timeout.
        x$1 - (undocumented)
      • akka$persistence$fsm$PersistentFSMBase$_setter_$StopEvent_$eq

        void akka$persistence$fsm$PersistentFSMBase$_setter_$StopEvent_$eq​(PersistentFSM.StopEvent$ x$1)
      • cancelTimer

        void cancelTimer​(java.lang.String name)
        Cancel named timer, ensuring that the message is not subsequently delivered (no race).
        name - of the timer to cancel
      • debugEvent

        boolean debugEvent()
      • generation_$eq

        void generation_$eq​(long x$1)
      • handleTransition

        void handleTransition​(S prev,
                              S next)
      • initialize

        void initialize()
        Removed from API, called internally. Since 2.4.5.
        Verify existence of initial state and setup timers. Used in PersistentFSM on recovery.

        An initial currentState -> currentState notification will be triggered by calling this method.

        See Also:
      • isStateTimerActive

        boolean isStateTimerActive()
        INTERNAL API, used for testing.
      • isTimerActive

        boolean isTimerActive​(java.lang.String name)
        Inquire whether the named timer is still active. Returns true unless the timer does not exist, has previously been canceled or if it was a single-shot timer whose message was already received.
        name - (undocumented)
      • logTermination

        void logTermination​(PersistentFSM.Reason reason)
        By default PersistentFSM.Failure is logged at error level and other reason types are not logged. It is possible to override this behavior.
        reason - (undocumented)
      • nextStateData

        D nextStateData()
        Return next state data (available in onTransition handlers)
      • onTermination

        void onTermination​(scala.PartialFunction<PersistentFSM.StopEvent<S,​D>,​scala.runtime.BoxedUnit> terminationHandler)
        Set handler which is called upon termination of this FSM actor. Calling this method again will overwrite the previous contents.
        terminationHandler - (undocumented)
      • onTransition

        void onTransition​(scala.PartialFunction<scala.Tuple2<S,​S>,​scala.runtime.BoxedUnit> transitionHandler)
        Set handler which is called upon each state transition, i.e. not when staying in the same state. This may use the pair extractor defined in the FSM companion object like so:

         onTransition {
           case Old -&gt; New =&gt; doSomething

        It is also possible to supply a 2-ary function object:

         onTransition(handler _)
         private def handler(from: S, to: S) { ... }

        The underscore is unfortunately necessary to enable the nicer syntax shown above (it uses the implicit conversion total2pf under the hood).

        Multiple handlers may be installed, and every one of them will be called, not only the first one matching.

        transitionHandler - (undocumented)
      • postStop

        void postStop()
               throws java.lang.Exception
        Call onTermination hook; if you want to retain this behavior when overriding make sure to call super.postStop().

        Please note that this method is called by default from preRestart(), so override that one if onTermination shall not be called during restart.

        Specified by:
        postStop in interface Actor
      • processMsg

        void processMsg​(java.lang.Object value,
                        java.lang.Object source)
      • receive

        scala.PartialFunction<java.lang.Object,​scala.runtime.BoxedUnit> receive()
        Description copied from interface: Actor
        Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.
        Specified by:
        receive in interface Actor
      • setStateTimeout

        void setStateTimeout​(S state,
                             scala.Option<scala.concurrent.duration.FiniteDuration> timeout)
        Set state timeout explicitly. This method can safely be used from within a state handler.
        state - (undocumented)
        timeout - (undocumented)
      • setTimer

        void setTimer​(java.lang.String name,
                      java.lang.Object msg,
                      scala.concurrent.duration.FiniteDuration timeout,
                      boolean repeat)
        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.
        name - identifier to be used with cancelTimer()
        msg - message to be delivered
        timeout - delay of first message delivery and between subsequent messages
        repeat - send once if false, scheduleAtFixedRate if true
      • setTimer$default$4

        boolean setTimer$default$4()
      • startWith

        void startWith​(S stateName,
                       D stateData,
                       scala.Option<scala.concurrent.duration.FiniteDuration> timeout)
        Set initial state. 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 Actor.preStart() and Actor.postRestart(java.lang.Throwable).

        stateName - initial state designator
        stateData - initial state data
        timeout - state timeout for the initial state, overriding the default timeout for that state
      • startWith$default$3

        scala.Option<scala.concurrent.duration.FiniteDuration> startWith$default$3()
      • stateData

        D stateData()
        Return current state data (i.e. object of type D)
      • stateName

        S stateName()
        Return current state name (i.e. object of type S)
      • stateNames

        scala.collection.Iterable<S> stateNames()
        Return all defined state names
      • stay

        PersistentFSM.State<S,​D,​E> stay()
        Produce "empty" transition descriptor. Return this from a state function when no state change is to be effected.

        No transition event will be triggered by stay(). If you want to trigger an event like S -&gt; S for onTransition to handle use goto instead.

        descriptor for staying in current state
      • stop

        PersistentFSM.State<S,​D,​E> stop()
        Produce change descriptor to stop this FSM actor with reason "Normal".
      • stop

        PersistentFSM.State<S,​D,​E> stop​(PersistentFSM.Reason reason)
        Produce change descriptor to stop this FSM actor including specified reason.
        reason - (undocumented)
      • stop

        PersistentFSM.State<S,​D,​E> stop​(PersistentFSM.Reason reason,
                                                    D stateData)
        Produce change descriptor to stop this FSM actor including specified reason.
        reason - (undocumented)
        stateData - (undocumented)
      • super$postStop

        void super$postStop()
        Call onTermination hook; if you want to retain this behavior when overriding make sure to call super.postStop().

        Please note that this method is called by default from preRestart(), so override that one if onTermination shall not be called during restart.

      • terminateEvent_$eq

        void terminateEvent_$eq​(scala.PartialFunction<PersistentFSM.StopEvent<S,​D>,​scala.runtime.BoxedUnit> x$1)
      • timeoutFuture_$eq

        void timeoutFuture_$eq​(scala.Option<Cancellable> x$1)
      • total2pf

        scala.PartialFunction<scala.Tuple2<S,​S>,​scala.runtime.BoxedUnit> total2pf​(scala.Function2<S,​S,​scala.runtime.BoxedUnit> transitionHandler)
        Convenience wrapper for using a total function instead of a partial function literal. To be used with onTransition.
        transitionHandler - (undocumented)
      • transitionEvent_$eq

        void transitionEvent_$eq​(scala.collection.immutable.List<scala.PartialFunction<scala.Tuple2<S,​S>,​scala.runtime.BoxedUnit>> x$1)
      • when

        void when​(S stateName,
                  scala.concurrent.duration.FiniteDuration stateTimeout,
                  scala.PartialFunction<PersistentFSM.Event<D>,​PersistentFSM.State<S,​D,​E>> stateFunction)
        Insert a new 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 StateTimeout event; the same is true when using #stay.

        stateName - designator for the state
        stateTimeout - default state timeout for this state
        stateFunction - partial function describing response to input
      • when$default$2

        scala.concurrent.duration.FiniteDuration when$default$2()
      • whenUnhandled

        void whenUnhandled​(scala.PartialFunction<PersistentFSM.Event<D>,​PersistentFSM.State<S,​D,​E>> stateFunction)
        Set handler which is called upon reception of unhandled messages. Calling this method again will overwrite the previous contents.

        The current state may be queried using stateName.

        stateFunction - (undocumented)