Class DurableStateBehaviorWithEnforcedReplies<Command,State>
- java.lang.Object
-
- akka.actor.typed.Behavior<T>
-
- akka.actor.typed.internal.BehaviorImpl.DeferredBehavior<Command>
-
- akka.persistence.typed.state.javadsl.DurableStateBehavior<Command,State>
-
- akka.persistence.typed.state.javadsl.DurableStateBehaviorWithEnforcedReplies<Command,State>
-
public abstract class DurableStateBehaviorWithEnforcedReplies<Command,State> extends DurableStateBehavior<Command,State>
ADurableStateBehavior
that is enforcing that replies to commands are not forgotten. There will be compilation errors if the returned effect isn't aReplyEffect
, which can be created withEffects().reply
,Effects().noReply
,EffectBuilder.thenReply
, orEffectBuilder.thenNoReply
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class akka.actor.typed.Behavior
Behavior.BehaviorDecorators<Inner>, Behavior.BehaviorDecorators$
-
-
Constructor Summary
Constructors Constructor Description DurableStateBehaviorWithEnforcedReplies(PersistenceId persistenceId)
DurableStateBehaviorWithEnforcedReplies(PersistenceId persistenceId, BackoffSupervisorStrategy backoffSupervisorStrategy)
DurableStateBehaviorWithEnforcedReplies(PersistenceId persistenceId, java.util.Optional<BackoffSupervisorStrategy> backoffSupervisorStrategy)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract CommandHandlerWithReply<Command,State>
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.protected CommandHandlerBuilder<Command,State>
newCommandHandlerBuilder()
UsenewCommandHandlerWithReplyBuilder()
instead, or extendDurableStateBehavior
instead ofDurableStateBehaviorWithEnforcedReplies
.protected CommandHandlerWithReplyBuilder<Command,State>
newCommandHandlerWithReplyBuilder()
-
Methods inherited from class akka.persistence.typed.state.javadsl.DurableStateBehavior
apply, changeEventHandler, durableStateStorePluginId, Effect, emptyState, lastSequenceNumber, newSignalHandlerBuilder, persistenceId, signalHandler, snapshotAdapter, stashCapacity, tag
-
Methods inherited from class akka.actor.typed.Behavior
BehaviorDecorators, canonicalize, existsInStack, interpretMessage, interpretSignal, isAlive, isDeferred, isUnhandled, narrow, start, validateAsInitial
-
-
-
-
Constructor Detail
-
DurableStateBehaviorWithEnforcedReplies
public DurableStateBehaviorWithEnforcedReplies(PersistenceId persistenceId, java.util.Optional<BackoffSupervisorStrategy> backoffSupervisorStrategy)
-
DurableStateBehaviorWithEnforcedReplies
public DurableStateBehaviorWithEnforcedReplies(PersistenceId persistenceId)
-
DurableStateBehaviorWithEnforcedReplies
public DurableStateBehaviorWithEnforcedReplies(PersistenceId persistenceId, BackoffSupervisorStrategy backoffSupervisorStrategy)
-
-
Method Detail
-
commandHandler
protected abstract CommandHandlerWithReply<Command,State> 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:
commandHandler
in classDurableStateBehavior<Command,State>
-
newCommandHandlerBuilder
protected CommandHandlerBuilder<Command,State> newCommandHandlerBuilder()
UsenewCommandHandlerWithReplyBuilder()
instead, or extendDurableStateBehavior
instead ofDurableStateBehaviorWithEnforcedReplies
.- Overrides:
newCommandHandlerBuilder
in classDurableStateBehavior<Command,State>
- Returns:
- A new, mutable, command handler builder
- Throws:
java.lang.UnsupportedOperationException
- use newCommandHandlerWithReplyBuilder instead
-
newCommandHandlerWithReplyBuilder
protected CommandHandlerWithReplyBuilder<Command,State> newCommandHandlerWithReplyBuilder()
- Returns:
- A new, mutable, command handler builder
-
-