Package org.apache.pekko.persistence.fsm
Class PersistentFSM.State<S,D,E>
- java.lang.Object
-
- org.apache.pekko.persistence.fsm.PersistentFSM.State<S,D,E>
-
- All Implemented Interfaces:
java.io.Serializable
,scala.Equals
,scala.Product
- Enclosing interface:
- PersistentFSM<S extends PersistentFSM.FSMState,D,E>
public static final class PersistentFSM.State<S,D,E> extends java.lang.Object implements scala.Product, java.io.Serializable
This captures all of the managed state of thepekko.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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description State(S stateName, D stateData, scala.Option<scala.concurrent.duration.FiniteDuration> timeout, scala.Option<PersistentFSM.Reason> stopReason, scala.collection.immutable.List<java.lang.Object> replies, scala.collection.immutable.Seq<E> domainEvents, scala.Function1<D,scala.runtime.BoxedUnit> afterTransitionDo, boolean notifies)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description scala.Function1<D,scala.runtime.BoxedUnit>
afterTransitionDo()
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 successfullyPersistentFSM.State<S,D,E>
applying(java.lang.Object... events)
Specify domain events to be applied when transitioning to the new state.PersistentFSM.State<S,D,E>
applying(scala.collection.immutable.Seq<E> events)
Specify domain events to be applied when transitioning to the new state.boolean
canEqual(java.lang.Object x$1)
<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<java.lang.Object> replies, scala.collection.immutable.Seq<E> domainEvents, scala.Function1<D,scala.runtime.BoxedUnit> afterTransitionDo, boolean notifies)
<S,D,E>
Scopy$default$1()
<S,D,E>
Dcopy$default$2()
<S,D,E>
scala.Option<scala.concurrent.duration.FiniteDuration>copy$default$3()
<S,D,E>
scala.Option<PersistentFSM.Reason>copy$default$4()
<S,D,E>
scala.collection.immutable.List<java.lang.Object>copy$default$5()
<S,D,E>
scala.collection.immutable.Seq<E>copy$default$6()
<S,D,E>
scala.Function1<D,scala.runtime.BoxedUnit>copy$default$7()
scala.collection.immutable.Seq<E>
domainEvents()
boolean
equals(java.lang.Object x$1)
PersistentFSM.State<S,D,E>
forMax(java.time.Duration timeout)
Java API: Modify state transition descriptor to include a state timeout for the next state.PersistentFSM.State<S,D,E>
forMax(scala.concurrent.duration.Duration timeout)
Modify state transition descriptor to include a state timeout for the next state.int
hashCode()
int
productArity()
java.lang.Object
productElement(int x$1)
java.lang.String
productElementName(int x$1)
scala.collection.Iterator<java.lang.Object>
productIterator()
java.lang.String
productPrefix()
scala.collection.immutable.List<java.lang.Object>
replies()
PersistentFSM.State<S,D,E>
replying(java.lang.Object replyValue)
Send reply to sender of the current message, if available.D
stateData()
S
stateName()
scala.Option<PersistentFSM.Reason>
stopReason()
scala.Option<scala.concurrent.duration.FiniteDuration>
timeout()
java.lang.String
toString()
-
-
-
Constructor Detail
-
State
public State(S stateName, D stateData, scala.Option<scala.concurrent.duration.FiniteDuration> timeout, scala.Option<PersistentFSM.Reason> stopReason, scala.collection.immutable.List<java.lang.Object> replies, scala.collection.immutable.Seq<E> domainEvents, scala.Function1<D,scala.runtime.BoxedUnit> afterTransitionDo, boolean notifies)
-
-
Method Detail
-
applying
public PersistentFSM.State<S,D,E> applying(java.lang.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<java.lang.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(java.time.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(java.lang.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<java.lang.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<java.lang.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 java.lang.String productPrefix()
- Specified by:
productPrefix
in interfacescala.Product
-
productArity
public int productArity()
- Specified by:
productArity
in interfacescala.Product
-
productElement
public java.lang.Object productElement(int x$1)
- Specified by:
productElement
in interfacescala.Product
-
productIterator
public scala.collection.Iterator<java.lang.Object> productIterator()
- Specified by:
productIterator
in interfacescala.Product
-
canEqual
public boolean canEqual(java.lang.Object x$1)
- Specified by:
canEqual
in interfacescala.Equals
-
productElementName
public java.lang.String productElementName(int x$1)
- Specified by:
productElementName
in interfacescala.Product
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object x$1)
- Specified by:
equals
in interfacescala.Equals
- Overrides:
equals
in classjava.lang.Object
-
-