Interface DurableStateBehavior<Command,State>
-
public interface DurableStateBehavior<Command,State>
Further customization of theDurableStateBehavior
can 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 class
DurableStateBehavior.CommandHandler$
TheCommandHandler
defines 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.PersistenceId
persistenceId()
DurableStateBehavior<Command,State>
receiveSignal(scala.PartialFunction<scala.Tuple2<State,Signal>,scala.runtime.BoxedUnit> signalHandler)
Allows theDurableStateBehavior
to 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.<ChangeEvent>
DurableStateBehavior<Command,State>withChangeEventHandler(ChangeEventHandler<Command,State,ChangeEvent> handler)
API May Change: Store additional change event when the state is updated or deleted.DurableStateBehavior<Command,State>
withDurableStateStorePluginId(java.lang.String id)
Change theDurableStateStore
plugin id that this actor should use.DurableStateBehavior<Command,State>
withStashCapacity(int size)
Define a custom stash capacity per entity.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 theDurableStateBehavior
to react on signals.The regular lifecycle signals can be handled as well as
DurableStateBehavior
specific signals (recovery related). Those are all subtypes ofDurableStateSignal
-
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 theDurableStateStore
plugin 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
DurableStateBehavior
not 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.
-
withStashCapacity
DurableStateBehavior<Command,State> withStashCapacity(int size)
Define a custom stash capacity per entity. If not defined, the defaultakka.persistence.typed.stash-capacity
will be used.
-
withChangeEventHandler
<ChangeEvent> DurableStateBehavior<Command,State> withChangeEventHandler(ChangeEventHandler<Command,State,ChangeEvent> handler)
API May Change: Store additional change event when the state is updated or deleted. The event can be used in Projections.
-
-