Class DurableStateBehaviorWithEnforcedReplies<Command,State>
java.lang.Object
org.apache.pekko.actor.typed.Behavior<T>
org.apache.pekko.actor.typed.internal.BehaviorImpl.DeferredBehavior<Command>
org.apache.pekko.persistence.typed.state.javadsl.DurableStateBehavior<Command,State>
org.apache.pekko.persistence.typed.state.javadsl.DurableStateBehaviorWithEnforcedReplies<Command,State>
public abstract class DurableStateBehaviorWithEnforcedReplies<Command,State>
extends DurableStateBehavior<Command,State>
A
DurableStateBehavior that is enforcing that replies to commands are not forgotten.
There will be compilation errors if the returned effect isn't a ReplyEffect, which can be
created with Effects().reply, Effects().noReply, EffectBuilder.thenReply, or EffectBuilder.thenNoReply.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.pekko.actor.typed.Behavior
Behavior.BehaviorDecorators<Inner>, Behavior.BehaviorDecorators$ -
Constructor Summary
ConstructorsConstructorDescriptionDurableStateBehaviorWithEnforcedReplies(PersistenceId persistenceId) DurableStateBehaviorWithEnforcedReplies(PersistenceId persistenceId, Optional<BackoffSupervisorStrategy> backoffSupervisorStrategy) DurableStateBehaviorWithEnforcedReplies(PersistenceId persistenceId, BackoffSupervisorStrategy backoffSupervisorStrategy) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract CommandHandlerWithReply<Command,State> Implement by handling incoming commands and return anEffect()to persist or signal other effects of the command handling such as stopping the behavior or others.protected CommandHandlerBuilder<Command,State> UsenewCommandHandlerWithReplyBuilder()instead, or extendDurableStateBehaviorinstead ofDurableStateBehaviorWithEnforcedReplies.protected CommandHandlerWithReplyBuilder<Command,State> Methods inherited from class org.apache.pekko.persistence.typed.state.javadsl.DurableStateBehavior
apply, durableStateStorePluginConfig, durableStateStorePluginId, Effect, emptyState, lastSequenceNumber, newSignalHandlerBuilder, persistenceId, signalHandler, snapshotAdapter, tagMethods inherited from class org.apache.pekko.actor.typed.Behavior
BehaviorDecorators, canonicalize, existsInStack, interpretMessage, interpretSignal, isAlive, isDeferred, isUnhandled, narrow, start, validateAsInitial
-
Constructor Details
-
DurableStateBehaviorWithEnforcedReplies
public DurableStateBehaviorWithEnforcedReplies(PersistenceId persistenceId, Optional<BackoffSupervisorStrategy> backoffSupervisorStrategy) -
DurableStateBehaviorWithEnforcedReplies
-
DurableStateBehaviorWithEnforcedReplies
public DurableStateBehaviorWithEnforcedReplies(PersistenceId persistenceId, BackoffSupervisorStrategy backoffSupervisorStrategy)
-
-
Method Details
-
commandHandler
Implement by handling incoming commands and return anEffect()to persist or signal other effects of the command handling such as stopping the behavior or others.Use
newCommandHandlerWithReplyBuilder()to define the command handlers.The command handlers are only invoked when the actor is running (i.e. not recovering). While the actor is persisting state, the incoming messages are stashed and only delivered to the handler once persisting them has completed.
- Specified by:
commandHandlerin classDurableStateBehavior<Command,State>
-
newCommandHandlerBuilder
UsenewCommandHandlerWithReplyBuilder()instead, or extendDurableStateBehaviorinstead ofDurableStateBehaviorWithEnforcedReplies.- Overrides:
newCommandHandlerBuilderin classDurableStateBehavior<Command,State> - Returns:
- A new, mutable, command handler builder
- Throws:
UnsupportedOperationException- use newCommandHandlerWithReplyBuilder instead
-
newCommandHandlerWithReplyBuilder
- Returns:
- A new, mutable, command handler builder
-