Search Results for

    Show / Hide Table of Contents

    Interface IAsyncRecovery

    TBD

    Namespace: Akka.Persistence.Journal
    Assembly: Akka.Persistence.dll
    Syntax
    public interface IAsyncRecovery

    Methods

    | Edit this page View Source

    ReadHighestSequenceNrAsync(string, long, CancellationToken)

    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, long, long, long, 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, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    string persistenceId

    Persistent actor identifier

    long fromSequenceNr

    Hint where to start searching for the highest sequence number. When a persistent actor is recovering this fromSequenceNr will the sequence number of the used snapshot, or 0L if no snapshot is used.

    CancellationToken cancellationToken

    CancellationToken used to signal cancelled recovery operation

    Returns
    Type Description
    Task<long>

    TBD

    | Edit this page View Source

    ReplayMessagesAsync(IActorContext, string, long, long, long, 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, long, CancellationToken) 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

    long fromSequenceNr

    Inclusive sequence number where replay should start

    long toSequenceNr

    Inclusive sequence number where replay should end

    long 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

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET