Implement by handling incoming commands and return an Effect()
to persist or signal other effects
of the command handling such as stopping the behavior or others.
Implement by handling incoming commands and return an Effect()
to persist or signal other effects
of the command handling such as stopping the behavior or others.
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.
Implement by returning the initial empty state object.
Implement by returning the initial empty state object. This object will be passed into this behaviors handlers, until a new state replaces it.
Also known as "zero state" or "neutral state".
Implement by applying the event to the current state in order to return a new state.
Implement by applying the event to the current state in order to return a new state.
The event handlers are invoked during recovery as well as running operation of this behavior, in order to keep updating the state state.
For that reason it is strongly discouraged to perform side-effects in this handler;
Side effects should be executed in andThen
or recoveryCompleted
blocks.
Factory of effects.
Factory of effects.
Return effects from your handlers in order to instruct persistence on how to act on the incoming message (i.e. persist events).
INTERNAL API: DeferredBehavior init
INTERNAL API: DeferredBehavior init
The handlers defined by this builder are used when the statePredicate
is true
,
* useful for example when state type is an Optional
A new, mutable, command handler builder
The handlers defined by this builder are used when the state is an instance of the stateClass
A new, mutable, command handler builder
A new, mutable, event handler builder
The callback
function is called to notify the actor that the recovery process
is finished.
Override to get notified when a snapshot is finished.
Override to get notified when a snapshot is finished.
None if successful otherwise contains the exception thrown when snapshotting
Initiates a snapshot if the given function returns true.
Initiates a snapshot if the given function returns true. When persisting multiple events at once the snapshot is triggered after all the events have been persisted.
receives the State, Event and the sequenceNr used for the Event
true
if snapshot should be saved for the given event
Override and define that snapshot should be saved every N events.
Override and define that snapshot should be saved every N events.
If this is overridden shouldSnapshot
is not used.
number of events between snapshots, should be greater than 0
The tagger
function should give event tags, which will be used in persistence query
(persistentBehavior: BehaviorDecorators[Command]).behavior
(persistentBehavior: BehaviorDecorators[Command]).behavior
(persistentBehavior: BehaviorDecorators[Command]).widen(matcher)
(persistentBehavior: BehaviorDecorators[Command]).widen(matcher)
Java API