Package akka.persistence.typed.javadsl
Class EventSourcedBehaviorWithEnforcedReplies<Command,Event,State>
- java.lang.Object
-
- akka.actor.typed.Behavior<T>
-
- akka.actor.typed.internal.BehaviorImpl.DeferredBehavior<Command>
-
- akka.persistence.typed.javadsl.EventSourcedBehavior<Command,Event,State>
-
- akka.persistence.typed.javadsl.EventSourcedBehaviorWithEnforcedReplies<Command,Event,State>
-
public abstract class EventSourcedBehaviorWithEnforcedReplies<Command,Event,State> extends EventSourcedBehavior<Command,Event,State>
AEventSourcedBehavior
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 EventSourcedBehaviorWithEnforcedReplies(PersistenceId persistenceId)
EventSourcedBehaviorWithEnforcedReplies(PersistenceId persistenceId, BackoffSupervisorStrategy backoffSupervisorStrategy)
EventSourcedBehaviorWithEnforcedReplies(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,Event,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,Event,State>
newCommandHandlerBuilder()
UsenewCommandHandlerWithReplyBuilder()
instead, or extendEventSourcedBehavior
instead ofEventSourcedBehaviorWithEnforcedReplies
.protected CommandHandlerWithReplyBuilder<Command,Event,State>
newCommandHandlerWithReplyBuilder()
-
Methods inherited from class akka.persistence.typed.javadsl.EventSourcedBehavior
apply, deleteEventsOnSnapshot, Effect, emptyState, eventAdapter, eventHandler, journalPluginId, lastSequenceNumber, newEventHandlerBuilder, newSignalHandlerBuilder, persistenceId, recovery, retentionCriteria, shouldSnapshot, signalHandler, snapshotAdapter, snapshotPluginId, snapshotSelectionCriteria, stashCapacity, tagsFor, tagsFor
-
Methods inherited from class akka.actor.typed.Behavior
BehaviorDecorators, canonicalize, existsInStack, interpretMessage, interpretSignal, isAlive, isDeferred, isUnhandled, narrow, start, validateAsInitial
-
-
-
-
Constructor Detail
-
EventSourcedBehaviorWithEnforcedReplies
public EventSourcedBehaviorWithEnforcedReplies(PersistenceId persistenceId, java.util.Optional<BackoffSupervisorStrategy> backoffSupervisorStrategy)
-
EventSourcedBehaviorWithEnforcedReplies
public EventSourcedBehaviorWithEnforcedReplies(PersistenceId persistenceId)
-
EventSourcedBehaviorWithEnforcedReplies
public EventSourcedBehaviorWithEnforcedReplies(PersistenceId persistenceId, BackoffSupervisorStrategy backoffSupervisorStrategy)
-
-
Method Detail
-
commandHandler
protected abstract CommandHandlerWithReply<Command,Event,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 replaying). While the actor is persisting events, the incoming messages are stashed and only delivered to the handler once persisting them has completed.
- Specified by:
commandHandler
in classEventSourcedBehavior<Command,Event,State>
-
newCommandHandlerBuilder
protected CommandHandlerBuilder<Command,Event,State> newCommandHandlerBuilder()
UsenewCommandHandlerWithReplyBuilder()
instead, or extendEventSourcedBehavior
instead ofEventSourcedBehaviorWithEnforcedReplies
.- Overrides:
newCommandHandlerBuilder
in classEventSourcedBehavior<Command,Event,State>
- Returns:
- A new, mutable, command handler builder
- Throws:
java.lang.UnsupportedOperationException
- use newCommandHandlerWithReplyBuilder instead
-
newCommandHandlerWithReplyBuilder
protected CommandHandlerWithReplyBuilder<Command,Event,State> newCommandHandlerWithReplyBuilder()
- Returns:
- A new, mutable, command handler builder
-
-