Optional aggregate id.
Optional aggregate id. It is used for routing DurableEvents to event-sourced destinations
which can be EventsourcedViews or EventsourcedActors. By default, an event is routed
to an event-sourced destination with an undefined aggregateId
. If a destination's aggregateId
is defined it will only receive events with a matching aggregate id in
DurableEvent#destinationAggregateIds.
Returns the command BehaviorContext.
Returns the event BehaviorContext.
Emitter aggregate id of the last handled event.
Emitter id of the last handled event.
Id of the local event log that initially wrote the event.
Sequence number of the last handled event.
Wall-clock timestamp of the last handled event.
Vector timestamp of the last handled event.
This actor's logging adapter.
Recovery completion handler.
Recovery completion handler. If called with a Failure
, the actor will be stopped in
any case, regardless of the action taken by the returned handler. The default handler
implementation does nothing and can be overridden by implementations.
Snapshot handler.
Sets recovering
to false
before calling super.postStop
.
Sets recovering
to false
before calling super.postStop
.
Sets recovering
to false
before calling super.preRestart
.
Sets recovering
to false
before calling super.preRestart
.
Initiates recovery.
Initiates recovery.
Initialization behavior.
Initialization behavior.
Returns true
if this actor is currently recovering internal state by consuming
replayed events from the event log.
Returns true
if this actor is currently recovering internal state by consuming
replayed events from the event log. Returns false
after recovery completed and
the actor switches to consuming live events.
Maximum number of events to be replayed to this actor before replaying is suspended.
Maximum number of events to be replayed to this actor before replaying is suspended. A suspended replay
is resumed automatically after all replayed events haven been handled by this actor's event handler
(= backpressure). The default value for the maximum replay batch size is given by configuration item
eventuate.log.replay-batch-size
. Configured values can be overridden by overriding this method.
Override to provide an application-defined log sequence number from which event replay will start.
Override to provide an application-defined log sequence number from which event replay will start.
If Some(snr)
is returned snapshot loading will be skipped and replay will start from
the given sequence number snr
.
If None
is returned the actor proceeds with the regular snapshot loading procedure.
Asynchronously saves the given snapshot
and calls handler
with the generated
snapshot metadata.
Asynchronously saves the given snapshot
and calls handler
with the generated
snapshot metadata. The handler
can obtain a reference to the initial message
sender with sender()
.
Returns the snapshot BehaviorContext.
Adds the current command to the user's command stash.
Adds the current command to the user's command stash. Must not be used in the event handler.
Prepends all stashed commands to the actor's mailbox and then clears the command stash.
Prepends all stashed commands to the actor's mailbox and then clears the command stash.
Has no effect if the actor is recovering i.e. if recovering
returns true
.
An actor that derives internal state from events stored in an event log. Events are pushed from the
eventLog
actor to this actor and handled with theonEvent
event handler. An event handler defines how internal state is updated from events.An
EventsourcedView
can also store snapshots of internal state with itssave
method. During (re-)start the latest snapshot saved by this actor (if any) is passed as argument to theonSnapshot
handler, if the handler is defined at that snapshot. If theonSnapshot
handler is not defined at that snapshot or is not overridden at all, event replay starts from scratch. Newer events that are not covered by the snapshot are handled byonEvent
afteronSnapshot
returns.By default, an
EventsourcedView
does not define anaggregateId
. In this case, theeventLog
pushes all events to this actor. If it defines anaggregateId
, theeventLog
actor only pushes those events that contain thataggregateId
value in theirroutingDestinations
set.An
EventsourcedView
can only consume events from itseventLog
but cannot produce new events. Commands sent to anEventsourcedView
during recovery are delayed until recovery completes.Event replay is subject to backpressure. After a configurable number of events (see
eventuate.log.replay-batch-size
configuration parameter), replay is suspended until these events have been handled byonEvent
and then resumed again. There's no backpressure mechanism for live event processing yet (but will come in future releases).EventsourcedProcessor
EventsourcedWriter
EventsourcedActor
DurableEvent