Class PersistentFSM.State<S,D,E>

java.lang.Object
org.apache.pekko.persistence.fsm.PersistentFSM.State<S,D,E>
All Implemented Interfaces:
Serializable, scala.Equals, scala.Product
Enclosing interface:
PersistentFSM<S extends PersistentFSM.FSMState,D,E>

public static final class PersistentFSM.State<S,D,E> extends Object implements scala.Product, Serializable
This captures all of the managed state of the pekko.actor.FSM: the state name, the state data, possibly custom timeout, stop reason, replies accumulated while processing the last message, possibly domain event and handler to be executed after FSM moves to the new state (also triggered when staying in the same state)
See Also:
  • Constructor Details

    • State

      public State(S stateName, D stateData, scala.Option<scala.concurrent.duration.FiniteDuration> timeout, scala.Option<PersistentFSM.Reason> stopReason, scala.collection.immutable.List<Object> replies, scala.collection.immutable.Seq<E> domainEvents, scala.Function1<D,scala.runtime.BoxedUnit> afterTransitionDo, boolean notifies)
  • Method Details

    • applying

      public PersistentFSM.State<S,D,E> applying(Object... events)
      Specify domain events to be applied when transitioning to the new state.
    • stateName

      public S stateName()
    • stateData

      public D stateData()
    • timeout

      public scala.Option<scala.concurrent.duration.FiniteDuration> timeout()
    • stopReason

      public scala.Option<PersistentFSM.Reason> stopReason()
    • replies

      public scala.collection.immutable.List<Object> replies()
    • domainEvents

      public scala.collection.immutable.Seq<E> domainEvents()
    • afterTransitionDo

      public scala.Function1<D,scala.runtime.BoxedUnit> afterTransitionDo()
    • forMax

      public PersistentFSM.State<S,D,E> forMax(scala.concurrent.duration.Duration timeout)
      Modify state transition descriptor to include a state timeout for the next state. This timeout overrides any default timeout set for the next state.

      Use Duration.Inf to deactivate an existing timeout.

    • forMax

      public PersistentFSM.State<S,D,E> forMax(Duration timeout)
      Java API: Modify state transition descriptor to include a state timeout for the next state. This timeout overrides any default timeout set for the next state.

      Use Duration.Inf to deactivate an existing timeout.

    • replying

      public PersistentFSM.State<S,D,E> replying(Object replyValue)
      Send reply to sender of the current message, if available.

      Returns:
      this state transition descriptor
    • applying

      public PersistentFSM.State<S,D,E> applying(scala.collection.immutable.Seq<E> events)
      Specify domain events to be applied when transitioning to the new state.
    • andThen

      public PersistentFSM.State<S,D,E> andThen(scala.Function1<D,scala.runtime.BoxedUnit> handler)
      Register a handler to be triggered after the state has been persisted successfully
    • copy

      public <S, D, E> PersistentFSM.State<S,D,E> copy(S stateName, D stateData, scala.Option<scala.concurrent.duration.FiniteDuration> timeout, scala.Option<PersistentFSM.Reason> stopReason, scala.collection.immutable.List<Object> replies, scala.collection.immutable.Seq<E> domainEvents, scala.Function1<D,scala.runtime.BoxedUnit> afterTransitionDo, boolean notifies)
    • copy$default$1

      public <S, D, E> S copy$default$1()
    • copy$default$2

      public <S, D, E> D copy$default$2()
    • copy$default$3

      public <S, D, E> scala.Option<scala.concurrent.duration.FiniteDuration> copy$default$3()
    • copy$default$4

      public <S, D, E> scala.Option<PersistentFSM.Reason> copy$default$4()
    • copy$default$5

      public <S, D, E> scala.collection.immutable.List<Object> copy$default$5()
    • copy$default$6

      public <S, D, E> scala.collection.immutable.Seq<E> copy$default$6()
    • copy$default$7

      public <S, D, E> scala.Function1<D,scala.runtime.BoxedUnit> copy$default$7()
    • productPrefix

      public String productPrefix()
      Specified by:
      productPrefix in interface scala.Product
    • productArity

      public int productArity()
      Specified by:
      productArity in interface scala.Product
    • productElement

      public Object productElement(int x$1)
      Specified by:
      productElement in interface scala.Product
    • productIterator

      public scala.collection.Iterator<Object> productIterator()
      Specified by:
      productIterator in interface scala.Product
    • canEqual

      public boolean canEqual(Object x$1)
      Specified by:
      canEqual in interface scala.Equals
    • productElementName

      public String productElementName(int x$1)
      Specified by:
      productElementName in interface scala.Product
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object x$1)
      Specified by:
      equals in interface scala.Equals
      Overrides:
      equals in class Object