Packages

  • package root
    Definition Classes
    root
  • package akka
    Definition Classes
    root
  • package actor
    Definition Classes
    akka
  • trait FSM[S, D] extends Actor with Listeners with ActorLogging

    Finite State Machine actor trait.

    Finite State Machine actor trait. Use as follows:

      object A {
        trait State
        case class One extends State
        case class Two extends State
    
        case class Data(i : Int)
      }
    
      class A extends Actor with FSM[A.State, A.Data] {
        import A._
    
        startWith(One, Data(42))
        when(One) {
            case Event(SomeMsg, Data(x)) => ...
            case Event(SomeOtherMsg, _) => ... // when data not needed
        }
        when(Two, stateTimeout = 5 seconds) { ... }
        initialize()
      }
    

    Within the partial function the following values are returned for effecting state transitions:

    • stay for staying in the same state
    • stay using Data(...) for staying in the same state, but with different data
    • stay forMax 5.millis for staying with a state timeout; can be combined with using
    • goto(...) for changing into a different state; also supports using and forMax
    • stop for terminating this FSM actor

    Each of the above also supports the method replying(AnyRef) for sending a reply before changing state.

    While changing state, custom handlers may be invoked which are registered using onTransition. This is meant to enable concentrating different concerns in different places; you may choose to use when for describing the properties of a state, including of course initiating transitions, but you can describe the transitions using onTransition to avoid having to duplicate that code among multiple paths which lead to a transition:

    onTransition {
      case Active -> _ => cancelTimer("activeTimer")
    }
    

    Multiple such blocks are supported and all of them will be called, not only the first matching one.

    Another feature is that other actors may subscribe for transition events by sending a SubscribeTransitionCallback message to this actor. Stopping a listener without unregistering will not remove the listener from the subscription list; use UnsubscribeTransitionCallback before stopping the listener.

    State timeouts set an upper bound to the time which may pass before another message is received in the current state. If no external message is available, then upon expiry of the timeout a StateTimeout message is sent. Note that this message will only be received in the state for which the timeout was set and that any message received will cancel the timeout (possibly to be started again by the next transition).

    Another feature is the ability to install and cancel single-shot as well as repeated timers which arrange for the sending of a user-specified message:

      setTimer("tock", TockMsg, 1 second, true) // repeating
      setTimer("lifetime", TerminateMsg, 1 hour, false) // single-shot
      cancelTimer("tock")
      isTimerActive("tock")
    

    Definition Classes
    actor
  • TransformHelper
c

akka.actor.FSM

TransformHelper

final class TransformHelper extends AnyRef

Source
FSM.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TransformHelper
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TransformHelper(func: StateFunction)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from TransformHelper to any2stringadd[TransformHelper] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (TransformHelper, B)
    Implicit
    This member is added by an implicit conversion from TransformHelper to ArrowAssoc[TransformHelper] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate() @throws( ... )
  8. def ensuring(cond: (TransformHelper) ⇒ Boolean, msg: ⇒ Any): TransformHelper
    Implicit
    This member is added by an implicit conversion from TransformHelper to Ensuring[TransformHelper] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  9. def ensuring(cond: (TransformHelper) ⇒ Boolean): TransformHelper
    Implicit
    This member is added by an implicit conversion from TransformHelper to Ensuring[TransformHelper] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: Boolean, msg: ⇒ Any): TransformHelper
    Implicit
    This member is added by an implicit conversion from TransformHelper to Ensuring[TransformHelper] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean): TransformHelper
    Implicit
    This member is added by an implicit conversion from TransformHelper to Ensuring[TransformHelper] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  14. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from TransformHelper to StringFormat[TransformHelper] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  15. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. def using(andThen: PartialFunction[State, State]): StateFunction
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. def [B](y: B): (TransformHelper, B)
    Implicit
    This member is added by an implicit conversion from TransformHelper to ArrowAssoc[TransformHelper] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from TransformHelper to any2stringadd[TransformHelper]

Inherited by implicit conversion StringFormat from TransformHelper to StringFormat[TransformHelper]

Inherited by implicit conversion Ensuring from TransformHelper to Ensuring[TransformHelper]

Inherited by implicit conversion ArrowAssoc from TransformHelper to ArrowAssoc[TransformHelper]

Ungrouped