Class EffectFactories<State>
- Direct Known Subclasses:
EffectFactories$
Effect directives - how a DurableStateBehavior reacts on a command.
Created via DurableStateBehavior.Effect.
Not for user extension
API May Change
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnone()Do not persist anythingnoReply()WhenDurableStateBehaviorWithEnforcedRepliesis used there will be compilation errors if the returned effect isn't aReplyEffect.final EffectBuilder<State>Persist new state.<ReplyMessage>
ReplyEffect<State>Send a reply message to the command.stash()Stash the current command.stop()Stop this persistent actorThis command is not handled, but it is not an error that it isn't.Unstash the commands that were stashed withEffectFactories.stash.
-
Constructor Details
-
EffectFactories
public EffectFactories()
-
-
Method Details
-
persist
Persist new state.Side effects can be chained with
thenRun. -
none
Do not persist anythingSide effects can be chained with
thenRun -
stop
Stop this persistent actorSide effects can be chained with
thenRun -
unhandled
This command is not handled, but it is not an error that it isn't.Side effects can be chained with
thenRun -
stash
Stash the current command. Can be unstashed later withEffect.thenUnstashAllorEffectFactories.unstashAll.Note that the stashed commands are kept in an in-memory buffer, so in case of a crash they will not be processed. They will also be discarded if the actor is restarted (or stopped) due to that an exception was thrown from processing a command or side effect after persisting. The stash buffer is preserved for persist failures if an
onPersistFailurebackoff supervisor strategy is defined.Side effects can be chained with
thenRun. -
unstashAll
Unstash the commands that were stashed withEffectFactories.stash.It's allowed to stash messages while unstashing. Those newly added commands will not be processed by this
unstashAlleffect and have to be unstashed by anotherunstashAll.- See Also:
-
EffectBuilder.thenUnstashAll
-
reply
public <ReplyMessage> ReplyEffect<State> reply(ActorRef<ReplyMessage> replyTo, ReplyMessage replyWithMessage) Send a reply message to the command. The type of the reply message must conform to the type specified by the passed replyToActorRef.This has the same semantics as
replyTo.tell.It is provided as a convenience (reducing boilerplate) and a way to enforce that replies are not forgotten when the
DurableStateBehavioris created withDurableStateBehaviorWithEnforcedReplies. WhenwithEnforcedRepliesis used there will be compilation errors if the returned effect isn't aReplyEffect. The reply message will be sent also ifwithEnforcedRepliesisn't used, but then the compiler will not help finding mistakes. -
noReply
WhenDurableStateBehaviorWithEnforcedRepliesis used there will be compilation errors if the returned effect isn't aReplyEffect. ThisnoReplycan be used as a conscious decision that a reply shouldn't be sent for a specific command or the reply will be sent later.
-