Class DurableStateBehavior$
java.lang.Object
org.apache.pekko.persistence.typed.state.scaladsl.DurableStateBehavior$
API May Change
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurableStateBehavior$Static reference to the singleton instance of this Scala object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<Command,State>
DurableStateBehavior<Command,State> apply(PersistenceId persistenceId, State emptyState, scala.Function2<State, Command, Effect<State>> commandHandler) Create aBehaviorfor a persistent actor with durable storage of its state.longlastSequenceNumber(ActorContext<?> context) The last sequence number that was persisted, can only be called from inside the handlers of aDurableStateBehavior<Command,State>
DurableStateBehavior<Command,State> withEnforcedReplies(PersistenceId persistenceId, State emptyState, scala.Function2<State, Command, ReplyEffect<State>> commandHandler) Create aBehaviorfor a persistent actor that is enforcing that replies to commands are not forgotten.
-
Field Details
-
MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Constructor Details
-
DurableStateBehavior$
public DurableStateBehavior$()
-
-
Method Details
-
apply
public <Command,State> DurableStateBehavior<Command,State> apply(PersistenceId persistenceId, State emptyState, scala.Function2<State, Command, Effect<State>> commandHandler) Create aBehaviorfor a persistent actor with durable storage of its state.- Parameters:
persistenceId- stable unique identifier for theDurableStateBehavioremptyState- the initial state for the entity before any state has been storedcommandHandler- map commands to effects e.g. persisting state, replying to commands
-
withEnforcedReplies
public <Command,State> DurableStateBehavior<Command,State> withEnforcedReplies(PersistenceId persistenceId, State emptyState, scala.Function2<State, Command, ReplyEffect<State>> commandHandler) Create aBehaviorfor a persistent actor that is enforcing that replies to commands are not forgotten. Then there will be compilation errors if the returned effect isn't aReplyEffect, which can be created withEffect.reply,Effect.noReply,EffectBuilder.thenReply, orEffectBuilder.thenNoReply. -
lastSequenceNumber
The last sequence number that was persisted, can only be called from inside the handlers of aDurableStateBehavior
-