Interface DurableStateBehavior<Command,State>
-
public interface DurableStateBehavior<Command,State>Further customization of theDurableStateBehaviorcan be done with the methods defined here.Not for user extension
API May Change
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classDurableStateBehavior.CommandHandler$TheCommandHandlerdefines how to act on commands.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DurableStateBehavior<Command,State>onPersistFailure(BackoffSupervisorStrategy backoffStrategy)Back off strategy for persist failures.PersistenceIdpersistenceId()DurableStateBehavior<Command,State>receiveSignal(scala.PartialFunction<scala.Tuple2<State,Signal>,scala.runtime.BoxedUnit> signalHandler)Allows theDurableStateBehaviorto react on signals.scala.PartialFunction<scala.Tuple2<State,Signal>,scala.runtime.BoxedUnit>signalHandler()DurableStateBehavior<Command,State>snapshotAdapter(SnapshotAdapter<State> adapter)Transform the state to another type before giving to the store.DurableStateBehavior<Command,State>withDurableStateStorePluginId(java.lang.String id)Change theDurableStateStoreplugin id that this actor should use.DurableStateBehavior<Command,State>withTag(java.lang.String tag)The tag that can used in persistence query
-
-
-
Method Detail
-
persistenceId
PersistenceId persistenceId()
-
receiveSignal
DurableStateBehavior<Command,State> receiveSignal(scala.PartialFunction<scala.Tuple2<State,Signal>,scala.runtime.BoxedUnit> signalHandler)
Allows theDurableStateBehaviorto react on signals.The regular lifecycle signals can be handled as well as
DurableStateBehaviorspecific signals (recovery related). Those are all subtypes ofpekko.persistence.typed.state.DurableStateSignal
-
signalHandler
scala.PartialFunction<scala.Tuple2<State,Signal>,scala.runtime.BoxedUnit> signalHandler()
- Returns:
- The currently defined signal handler or an empty handler if no custom handler previously defined
-
withDurableStateStorePluginId
DurableStateBehavior<Command,State> withDurableStateStorePluginId(java.lang.String id)
Change theDurableStateStoreplugin id that this actor should use.
-
withTag
DurableStateBehavior<Command,State> withTag(java.lang.String tag)
The tag that can used in persistence query
-
snapshotAdapter
DurableStateBehavior<Command,State> snapshotAdapter(SnapshotAdapter<State> adapter)
Transform the state to another type before giving to the store. Can be used to transform older state types into the current state type e.g. when migrating from Persistent FSM to Typed DurableStateBehavior.
-
onPersistFailure
DurableStateBehavior<Command,State> onPersistFailure(BackoffSupervisorStrategy backoffStrategy)
Back off strategy for persist failures.Specifically BackOff to prevent resume being used. Resume is not allowed as it will be unknown if the state has been persisted.
This supervision is only around the
DurableStateBehaviornot any outer setup/withTimers block. If using restart, any actions e.g. scheduling timers, can be done on the PreRestartIf not specified the actor will be stopped on failure.
-
-