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 command BehaviorContext.
Java API of the command handler.
Java API of the command handler.
Returns a receive object that defines the actor's command handling behaviour. Use ReceiveBuilder to define the behaviour.
Java API of the event handler.
Java API of the event handler.
Returns a receive object that defines the actor's event handling behaviour. Use ReceiveBuilder to define the behaviour.
Java API of the recovery handler.
Java API of the recovery handler.
Returns a result handler that defines the actor's recover handling behaviour. Use ResultHandler to define the behaviour.
Java API of the snapshot handler.
Java API of the snapshot handler.
Returns a receive object that defines the actor's snapshot handling behaviour. Use ReceiveBuilder to define the behaviour.
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 by persisting a confirmation event
with persistConfirmation
, using the same deliveryId
.
Returns the event BehaviorContext.
Returns the event BehaviorContext.
Event log actor.
Event log actor.
Java API of aggregateId.
Java API of aggregateId.
Java API of commandContext.
Java API of commandContext.
Returns the command BehaviorContext.
Returns this AbstractActor's ActorContext.
Returns this AbstractActor's ActorContext. Mimics AbstractActor.getContext.
Java API of eventContext.
Java API of eventContext.
Returns the event BehaviorContext.
Java API of lastEmitterAggregateId.
Java API of lastEmitterAggregateId.
Java API of lastEmitterId.
Java API of lastEmitterId.
Java API of lastSequenceNr.
Java API of lastSequenceNr.
Java API of lastSystemTimestamp.
Java API of lastSystemTimestamp.
Java API of lastVectorTimestamp.
Java API of lastVectorTimestamp.
Returns the ActorRef for this actor.
Returns the ActorRef for this actor. Mimics AbstractActor.getSelf.
The reference sender Actor of the currently processed message.
The reference sender Actor of the currently processed message. Mimics AbstractActor.getSender.
Java API of snapshotContext.
Java API of snapshotContext.
Returns the snapshot BehaviorContext.
Java API of unconfirmed.
Java API of unconfirmed.
Global unique actor id.
Global unique actor id.
Java API of lastEmirecoveringterId.
Java API of lastEmirecoveringterId.
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.
Id of the local event log that initially wrote the event.
Id of the local event log that initially wrote the 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.
This actor's logging adapter.
This actor's logging adapter.
Command handler.
Command handler.
Event handler.
Event handler.
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.
Snapshot handler.
Java API of persist.
Java API of persist.
Calls the given handler
with the persist result for the event.
Multiple routing destinations can be defined with the customDestinationAggregateIds
.
Java API of persist.
Java API of persist.
Calls the given handler
with the persist result for the event.
Asynchronously persists the given event
and calls handler
with the persist result.
Asynchronously persists the given event
and calls handler
with the persist result. If
persistence was successful, onEvent
is called with the persisted event before handler
is called. Both, onEvent
and handler
, are called on a dispatcher thread of this actor,
hence, it is safe to modify internal state within them. 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.
Java API of persistConfirmation.
Java API of persistConfirmation.
Java API of persistConfirmation.
Java API of persistConfirmation.
Same semantics as EventsourcedActor.persist plus additional storage of a deliveryId
together with the persistent event
.
Same semantics as EventsourcedActor.persist plus additional storage of a deliveryId
together with the persistent event
.
Java API of persistN.
Java API of persistN.
Calls the given handler
with the persist result for each event in the sequence.
Accepts an onLast
handler that will be called after persisting the last event of the sequence.
Multiple routing destinations can be defined with the customDestinationAggregateIds
.
Java API of persistN.
Java API of persistN.
Calls the given handler
with the persist result for each event in the sequence.
Multiple routing destinations can be defined with the customDestinationAggregateIds
.
Java API of persistN.
Java API of persistN.
Calls the given handler
with the persist result for each event in the sequence.
Accepts an onLast
handler that will be called after persisting the last event of the sequence.
Java API of persistN.
Java API of persistN.
Calls the given handler
with the persist result for each event in the sequence.
Asynchronously persists a sequence of events
and calls handler
with the persist result
for each event in the sequence.
Asynchronously persists a sequence of events
and calls handler
with the persist result
for each event in the sequence. If persistence was successful, onEvent
is called with a
persisted event before handler
is called. Both, onEvent
and handler
, are called on a
dispatcher thread of this actor, hence, it is safe to modify internal state within them.
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.
Java API of persistOnEvent.
Java API of persistOnEvent.
Multiple routing destinations can be defined with the customDestinationAggregateIds
.
Java API of persistOnEvent.
Java API of persistOnEvent.
Asynchronously persists the given event
.
Asynchronously persists the given event
. Applications that want to handle the persisted event should define
the event handler at that event. 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.
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.
Creates a new empty ReceiveBuilder
.
Creates a new empty ReceiveBuilder
. Mimics AbstractActor.receiveBuilder.
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.
Redelivers all unconfirmed messages.
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.
Java API of save.
Java API of save.
Must be supplied with a ResultHandler to process successful or failed results.
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.
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
or persist
handler.
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 is eventually
consistent with the event log.
Delivery ids of unconfirmed messages.
Delivery ids of unconfirmed messages.
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
.
Java API for actors that implement EventsourcedActor.
EventsourcedActor
AbstractEventsourcedView for a detailed usage of the Java API