Interface IAsyncRecovery
TBD
Namespace: Akka.Persistence.Journal
Assembly: Akka.Persistence.dll
Syntax
public interface IAsyncRecovery
Methods
| Improve this Doc View SourceReadHighestSequenceNrAsync(String, Int64)
Asynchronously reads the highest stored sequence number for provided persistenceId
.
The persistent actor will use the highest sequence number after recovery as the starting point when
persisting new events.
This sequence number is also used as toSequenceNr
in subsequent calls to
ReplayMessagesAsync(IActorContext, String, Int64, Int64, Int64, Action<IPersistentRepresentation>) unless the user has specified a lower toSequenceNr
.
Journal must maintain the highest sequence number and never decrease it.
This call is protected with a circuit-breaker.
Please also not that requests for the highest sequence number may be made concurrently
to writes executing for the same persistenceId
, in particular it is
possible that a restarting actor tries to recover before its outstanding writes have completed.
Declaration
Task<long> ReadHighestSequenceNrAsync(string persistenceId, long fromSequenceNr)
Parameters
Type | Name | Description |
---|---|---|
String | persistenceId | Persistent actor identifier |
Int64 | fromSequenceNr | Hint where to start searching for the highest sequence number.
When a persistent actor is recovering this |
Returns
Type | Description |
---|---|
Task<Int64> | TBD |
ReplayMessagesAsync(IActorContext, String, Int64, Int64, Int64, Action<IPersistentRepresentation>)
Asynchronously replays persistent messages. Implementations replay
a message by calling recoveryCallback
. The returned task must be completed
when all messages (matching the sequence number bounds) have been replayed.
The task must be completed with a failure if any of the persistent messages
could not be replayed.
The toSequenceNr
is the lowest of what was returned by
ReadHighestSequenceNrAsync(String, Int64) and what the user specified as recovery
Recovery parameter.
This does imply that this call is always preceded by reading the highest sequence number
for the given persistenceId
.
This call is NOT protected with a circuit-breaker because it may take a long time to replay all events. The plugin implementation itself must protect against an unresponsive backend store and make sure that the returned Task is completed with success or failure within reasonable time. It is not allowed to ignore completing the Task.
Declaration
Task ReplayMessagesAsync(IActorContext context, string persistenceId, long fromSequenceNr, long toSequenceNr, long max, Action<IPersistentRepresentation> recoveryCallback)
Parameters
Type | Name | Description |
---|---|---|
IActorContext | context | The contextual information about the actor processing replayed messages. |
String | persistenceId | Persistent actor identifier |
Int64 | fromSequenceNr | Inclusive sequence number where replay should start |
Int64 | toSequenceNr | Inclusive sequence number where replay should end |
Int64 | max | Maximum number of messages to be replayed |
Action<IPersistentRepresentation> | recoveryCallback | Called to replay a message, may be called from any thread. |
Returns
Type | Description |
---|---|
Task | TBD |