Class Effect$
Effect directives - how an event sourced actor reacts on a command.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<Event,State>
EffectBuilder<Event,State> none()Do not persist anything<Event,State>
ReplyEffect<Event,State> noReply()WhenEventSourcedBehavior.withEnforcedRepliesis used there will be compilation errors if the returned effect isn't aReplyEffect.<Event,A extends Event, B extends Event, State>
EffectBuilder<Event,State> persist(A evt1, B evt2, scala.collection.immutable.Seq<Event> events) Persist multiple events<Event,State>
EffectBuilder<Event,State> persist(Event event) Persist a single event<Event,State>
EffectBuilder<Event,State> persist(scala.collection.immutable.Seq<Event> events) Persist multiple events<ReplyMessage,Event, State>
ReplyEffect<Event,State> Send a reply message to the command.<Event,State>
ReplyEffect<Event,State> stash()Stash the current command.<Event,State>
EffectBuilder<Event,State> stop()Stop this persistent actor Side effects can be chained withthenRun<Event,State>
EffectBuilder<Event,State> This command is not handled, but it is not an error that it isn't.<Event,State>
Effect<Event,State> Unstash the commands that were stashed withEffect.stash.
-
Field Details
-
MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Constructor Details
-
Effect$
public Effect$()
-
-
Method Details
-
persist
Persist a single eventSide effects can be chained with
thenRun -
persist
public <Event,A extends Event, EffectBuilder<Event,B extends Event, State> State> persist(A evt1, B evt2, scala.collection.immutable.Seq<Event> events) Persist multiple eventsSide effects can be chained with
thenRun -
persist
public <Event,State> EffectBuilder<Event,State> persist(scala.collection.immutable.Seq<Event> events) Persist multiple eventsSide effects can be chained with
thenRun -
none
Do not persist anythingSide 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 -
stop
Stop this persistent actor Side effects can be chained withthenRun -
stash
Stash the current command. Can be unstashed later withEffect.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 a backoff supervisor strategy is defined with
EventSourcedBehavior.onPersistFailure.Side effects can be chained with
thenRun -
unstashAll
Unstash the commands that were stashed withEffect.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,Event, ReplyEffect<Event,State> 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
cmd.replyTo.tell.It is provided as a convenience (reducing boilerplate) and a way to enforce that replies are not forgotten when the
EventSourcedBehavioris created withEventSourcedBehavior.withEnforcedReplies. 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
WhenEventSourcedBehavior.withEnforcedRepliesis 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.
-