Search Results for

    Show / Hide Table of Contents

    Class CoordinatedShutdown

    An ActorSystem extension used to help coordinate and sequence shutdown activities during graceful termination of actor systems, plugins, and so forth.

    Inheritance
    object
    CoordinatedShutdown
    Implements
    IExtension
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Actor
    Assembly: Akka.dll
    Syntax
    public sealed class CoordinatedShutdown : IExtension

    Fields

    | Edit this page View Source

    PhaseActorSystemTerminate

    Declaration
    public const string PhaseActorSystemTerminate = "actor-system-terminate"
    Field Value
    Type Description
    string
    | Edit this page View Source

    PhaseBeforeActorSystemTerminate

    Declaration
    public const string PhaseBeforeActorSystemTerminate = "before-actor-system-terminate"
    Field Value
    Type Description
    string
    | Edit this page View Source

    PhaseBeforeClusterShutdown

    Declaration
    public const string PhaseBeforeClusterShutdown = "before-cluster-shutdown"
    Field Value
    Type Description
    string
    | Edit this page View Source

    PhaseBeforeServiceUnbind

    Declaration
    public const string PhaseBeforeServiceUnbind = "before-service-unbind"
    Field Value
    Type Description
    string
    | Edit this page View Source

    PhaseClusterExiting

    Declaration
    public const string PhaseClusterExiting = "cluster-exiting"
    Field Value
    Type Description
    string
    | Edit this page View Source

    PhaseClusterExitingDone

    Declaration
    public const string PhaseClusterExitingDone = "cluster-exiting-done"
    Field Value
    Type Description
    string
    | Edit this page View Source

    PhaseClusterLeave

    Declaration
    public const string PhaseClusterLeave = "cluster-leave"
    Field Value
    Type Description
    string
    | Edit this page View Source

    PhaseClusterShardingShutdownRegion

    Declaration
    public const string PhaseClusterShardingShutdownRegion = "cluster-sharding-shutdown-region"
    Field Value
    Type Description
    string
    | Edit this page View Source

    PhaseClusterShutdown

    Declaration
    public const string PhaseClusterShutdown = "cluster-shutdown"
    Field Value
    Type Description
    string
    | Edit this page View Source

    PhaseServiceRequestsDone

    Declaration
    public const string PhaseServiceRequestsDone = "service-requests-done"
    Field Value
    Type Description
    string
    | Edit this page View Source

    PhaseServiceStop

    Declaration
    public const string PhaseServiceStop = "service-stop"
    Field Value
    Type Description
    string
    | Edit this page View Source

    PhaseServiceUnbind

    Declaration
    public const string PhaseServiceUnbind = "service-unbind"
    Field Value
    Type Description
    string

    Properties

    | Edit this page View Source

    ShutdownReason

    The CoordinatedShutdown.Reason for the shutdown as passed to the Run(Reason, string) method. null if the shutdown has not been started.

    Declaration
    public CoordinatedShutdown.Reason ShutdownReason { get; }
    Property Value
    Type Description
    CoordinatedShutdown.Reason
    | Edit this page View Source

    System

    The ActorSystem

    Declaration
    public ExtendedActorSystem System { get; }
    Property Value
    Type Description
    ExtendedActorSystem
    | Edit this page View Source

    TotalTimeout

    The sum of timeouts of all phases that have some task.

    Declaration
    public TimeSpan TotalTimeout { get; }
    Property Value
    Type Description
    TimeSpan

    Methods

    | Edit this page View Source

    AddTask(string, string, Func<Task<Done>>)

    Add a task to a phase. It doesn't remove previously added tasks.

    Tasks added to the same phase are executed in parallel without any ordering assumptions. Next phase will not start until all tasks of previous phase have completed.

    Declaration
    public void AddTask(string phase, string taskName, Func<Task<Done>> task)
    Parameters
    Type Name Description
    string phase

    The phase to add this task to.

    string taskName

    The name of the task to add to this phase.

    Func<Task<Done>> task

    The delegate that produces a Task that will be executed.

    Remarks

    Tasks should typically be registered as early as possible after system startup. When running the CoordinatedShutdown tasks that have been registered will be performed but tasks that are added too late will not be run.

    It is possible to add a task to a later phase from within a task in an earlier phase and it will be performed.

    | Edit this page View Source

    Get(ActorSystem)

    Retrieves the CoordinatedShutdown extension for the current ActorSystem

    Declaration
    public static CoordinatedShutdown Get(ActorSystem sys)
    Parameters
    Type Name Description
    ActorSystem sys

    The current actor system.

    Returns
    Type Description
    CoordinatedShutdown

    A CoordinatedShutdown instance.

    | Edit this page View Source

    Run(Reason, string)

    Run tasks of all phases including and after the given phase.

    Declaration
    public Task<Done> Run(CoordinatedShutdown.Reason reason, string fromPhase = null)
    Parameters
    Type Name Description
    CoordinatedShutdown.Reason reason

    Reason of the shutdown

    string fromPhase

    Optional. The phase to start the run from.

    Returns
    Type Description
    Task<Done>

    A task that is completed when all such tasks have been completed, or there is failure when Akka.Actor.Phase.Recover is disabled.

    Remarks

    It is safe to call this method multiple times. It will only run the shutdown sequence once.

    | Edit this page View Source

    Timeout(string)

    The configured timeout for a given Akka.Actor.Phase.

    Declaration
    public TimeSpan Timeout(string phase)
    Parameters
    Type Name Description
    string phase

    The name of the phase.

    Returns
    Type Description
    TimeSpan

    Returns the timeout if ti exists.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if phase doesn't exist in the set of registered phases.

    Implements

    IExtension

    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