Event log actor.
Event log actor.
Global unique actor id.
Global unique actor id.
Command handler.
Command handler.
Event handler.
Event handler.
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.
Confirms the message delivery identified by deliveryId
.
Delays handling of command
to that point in the future where all previously called persist
or persistN
operations completed.
Delays handling of command
to that point in the future where all previously called persist
or persistN
operations completed. Therefore, using this method only makes sense if stateSync
is set to false
. The handler
is called during a separate message dispatch by this actor,
hence, it is safe to access internal state within handler
.
Delivers the given message
to a destination
.
Delivers the given message
to a destination
. The delivery of message
is identified by
the given deliveryId
which must be unique in context of the sending actor. The message is
tracked as unconfirmed message until delivery is confirmed with confirm
, using the same
deliveryId
.
Internal API.
Internal API.
Internal API.
Internal API.
Internal API.
Internal API.
Emitter aggregate id of the last handled event.
Emitter aggregate id of the last handled event.
Emitter id of the last handled event.
Emitter id of the last handled event.
Sequence number of the last handled event.
Sequence number of the last handled event.
Wall-clock timestamp of the last handled event.
Wall-clock timestamp of the last handled event.
Vector timestamp of the last handled event.
Vector timestamp of the last handled event.
Sends a LoadSnapshot command to the event log.
Sends a LoadSnapshot command to the event log. Can be overridden by implementations to customize snapshot loading.
Called after recovery successfully completed.
Called after recovery successfully completed. Can be overridden by implementations.
Snapshot handler.
Snapshot handler.
Asynchronously persists the given event
and calls handler
with the persist result.
Asynchronously persists the given event
and calls handler
with the persist result.
The handler
is called during a separate message dispatch by this actor, hence, it is
safe to modify internal state within handler
. The handler
can also obtain a reference
to the initial command sender via sender()
.
By default, the event is routed to event-sourced destinations with an undefined aggregateId
.
If this actor's aggregateId
is defined it is additionally routed to all actors with the same
aggregateId
. Further routing destinations can be defined with the customDestinationAggregateIds
parameter.
Asynchronously persists a sequence of events
and calls handler
with the persist
results.
Asynchronously persists a sequence of events
and calls handler
with the persist
results. The handler
is called for each event in the sequence during a separate
message dispatch by this actor, hence, it is safe to modify internal state within
handler
. The handler
can also obtain a reference to the initial command sender
via sender()
. The onLast
handler is additionally called for the last event in
the sequence.
By default, the event is routed to event-sourced destinations with an undefined aggregateId
.
If this actor's aggregateId
is defined it is additionally routed to all actors with the same
aggregateId
. Further routing destinations can be defined with the customDestinationAggregateIds
parameter.
Asynchronously persists the event returned by f
and calls handler
with the persist
result.
Asynchronously persists the event returned by f
and calls handler
with the persist
result. The input parameter to f
is the current local time which is the actor's logical
time, taken from its internal vector clock, and not the current system time. The handler
is called during a separate message dispatch by this actor, hence, it is safe to modify
internal state within handler
. The handler
can also obtain a reference to the initial
command sender via sender()
.
By default, the event is routed to event-sourced destinations with an undefined aggregateId
.
If this actor's aggregateId
is defined it is additionally routed to all actors with the same
aggregateId
. Further routing destinations can be defined with the customDestinationAggregateIds
parameter.
Initiates recovery by calling load.
Initiates recovery by calling load.
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.
Redelivers all unconfirmed messages.
Sends a Replay command to the event log.
Sends a Replay command to the event log. Can be overridden by implementations to customize replay.
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 also obtain a reference to the initial message
sender via sender()
.
State synchronization.
State synchronization. If set to true
, commands see internal state that is
consistent with the event log. This is achieved by stashing new commands if this actor
is currently writing events.
If set to false
, commands see internal state that might be stale. To see state updates
from any previously persisted events, applications can delay
these commands. In this mode,
commands are not stashed and events can be batched for write which significantly increases
write throughput.
Delivery ids of unconfirmed messages.
Supports the reliable delivery of messages to destinations by enabling applications to redeliver messages until they are confirmed by their destinations. Both, message delivery and confirmation must be executed within an EventsourcedActor's event handler. New messages are delivered by calling
deliver
. When the destination replies with a confirmation message, the EventsourcedActor must generate an event for which the handler callsconfirm
. Until confirmation, delivered messages are tracked as unconfirmed messages. Unconfirmed messages can be redelivered by callingredeliverUnconfirmed
. This is usually done within a command handler by processing scheduler messages. Redelivery occurs automatically when the EventsourcedActor successfully recovered after initial start or a re-start.