Interface DurableStateBehavior<Command,​State>


  • public interface DurableStateBehavior<Command,​State>
    Further customization of the DurableStateBehavior can be done with the methods defined here.

    Not for user extension

    API May Change

    • Method Detail

      • receiveSignal

        DurableStateBehavior<Command,​State> receiveSignal​(scala.PartialFunction<scala.Tuple2<State,​Signal>,​scala.runtime.BoxedUnit> signalHandler)
        Allows the DurableStateBehavior to react on signals.

        The regular lifecycle signals can be handled as well as DurableStateBehavior specific signals (recovery related). Those are all subtypes of 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 the DurableStateStore plugin id that this actor should use.
      • 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 PreRestart

        If 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 default akka.persistence.typed.stash-capacity will be used.