Search Results for

    Show / Hide Table of Contents

    Class ClusterSingletonManager

    Manages singleton actor instance among all cluster nodes or a group of nodes tagged with a specific role. At most one singleton instance is running at any point in time.

    The ClusterSingletonManager is supposed to be started on all nodes, or all nodes with specified role, in the cluster with ActorOf(Props, string). The actual singleton is started on the oldest node by creating a child actor from the supplied `singletonProps`.

    The singleton actor is always running on the oldest member with specified role. The oldest member is determined by IsOlderThan(Member). This can change when removing members. A graceful hand over can normally be performed when current oldest node is leaving the cluster. Be aware that there is a short time period when there is no active singleton during the hand-over process.

    The cluster failure detector will notice when oldest node becomes unreachable due to things like CLR crash, hard shut down, or network failure. When the crashed node has been removed (via down) from the cluster then a new oldest node will take over and a new singleton actor is created.For these failure scenarios there will not be a graceful hand-over, but more than one active singletons is prevented by all reasonable means. Some corner cases are eventually resolved by configurable timeouts.

    You access the singleton actor with ClusterSingletonProxy. Alternatively the singleton actor may broadcast its existence when it is started.

    Use one of the factory methods ClusterSingletonManager.Props to create the Props for the actor.

    Inheritance
    object
    ActorBase
    FSMBase
    FSM<ClusterSingletonState, IClusterSingletonData>
    ClusterSingletonManager
    Implements
    IInternalActor
    IListeners
    Inherited Members
    FSM<ClusterSingletonState, IClusterSingletonData>.When(ClusterSingletonState, FSM<ClusterSingletonState, IClusterSingletonData>.StateFunction, TimeSpan?)
    FSM<ClusterSingletonState, IClusterSingletonData>.StartWith(ClusterSingletonState, IClusterSingletonData, TimeSpan?)
    FSM<ClusterSingletonState, IClusterSingletonData>.GoTo(ClusterSingletonState)
    FSM<ClusterSingletonState, IClusterSingletonData>.GoTo(ClusterSingletonState, IClusterSingletonData)
    FSM<ClusterSingletonState, IClusterSingletonData>.Stay()
    FSM<ClusterSingletonState, IClusterSingletonData>.Stop()
    FSM<ClusterSingletonState, IClusterSingletonData>.Stop(FSMBase.Reason)
    FSM<ClusterSingletonState, IClusterSingletonData>.Stop(FSMBase.Reason, IClusterSingletonData)
    FSM<ClusterSingletonState, IClusterSingletonData>.Transform(FSM<ClusterSingletonState, IClusterSingletonData>.StateFunction)
    FSM<ClusterSingletonState, IClusterSingletonData>.SetTimer(string, object, TimeSpan, bool)
    FSM<ClusterSingletonState, IClusterSingletonData>.CancelTimer(string)
    FSM<ClusterSingletonState, IClusterSingletonData>.IsTimerActive(string)
    FSM<ClusterSingletonState, IClusterSingletonData>.SetStateTimeout(ClusterSingletonState, TimeSpan?)
    FSM<ClusterSingletonState, IClusterSingletonData>.OnTransition(FSM<ClusterSingletonState, IClusterSingletonData>.TransitionHandler)
    FSM<ClusterSingletonState, IClusterSingletonData>.OnTermination(Action<FSMBase.StopEvent<ClusterSingletonState, IClusterSingletonData>>)
    FSM<ClusterSingletonState, IClusterSingletonData>.WhenUnhandled(FSM<ClusterSingletonState, IClusterSingletonData>.StateFunction)
    FSM<ClusterSingletonState, IClusterSingletonData>.Initialize()
    FSM<ClusterSingletonState, IClusterSingletonData>.StateName
    FSM<ClusterSingletonState, IClusterSingletonData>.StateData
    FSM<ClusterSingletonState, IClusterSingletonData>.NextStateData
    FSM<ClusterSingletonState, IClusterSingletonData>.Listeners
    ActorBase.AroundPreRestart(Exception, object)
    ActorBase.AroundPreStart()
    ActorBase.AroundPostRestart(Exception, object)
    ActorBase.AroundPostStop()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Cluster.Tools.Singleton
    Assembly: Akka.Cluster.Tools.dll
    Syntax
    public sealed class ClusterSingletonManager : FSM<ClusterSingletonState, IClusterSingletonData>, IInternalActor, IListeners

    Constructors

    | Edit this page View Source

    ClusterSingletonManager(Props, object, ClusterSingletonManagerSettings)

    Declaration
    public ClusterSingletonManager(Props singletonProps, object terminationMessage, ClusterSingletonManagerSettings settings)
    Parameters
    Type Name Description
    Props singletonProps
    object terminationMessage
    ClusterSingletonManagerSettings settings

    Methods

    | Edit this page View Source

    DefaultConfig()

    Returns default HOCON configuration for the cluster singleton.

    Declaration
    [Obsolete("Deprecated and will be removed in v1.6, please use ClusterSingleton.DefaultConfig() instead. Since 1.5.32.")]
    public static Config DefaultConfig()
    Returns
    Type Description
    Config

    TBD

    | Edit this page View Source

    PostStop()

    User overridable callback.

    Is called asynchronously after 'actor.stop()' is invoked. Empty default implementation.
    Declaration
    protected override void PostStop()
    Overrides
    FSM<ClusterSingletonState, IClusterSingletonData>.PostStop()
    | Edit this page View Source

    PreStart()

    User overridable callback.

    Is called when an Actor is started. Actors are automatically started asynchronously when created. Empty default implementation.
    Declaration
    protected override void PreStart()
    Overrides
    ActorBase.PreStart()
    | Edit this page View Source

    Props(Props, ClusterSingletonManagerSettings)

    Creates props for the current cluster singleton manager using PoisonPill as the default termination message.

    Declaration
    public static Props Props(Props singletonProps, ClusterSingletonManagerSettings settings)
    Parameters
    Type Name Description
    Props singletonProps

    Props of the singleton actor instance.

    ClusterSingletonManagerSettings settings

    Cluster singleton manager settings.

    Returns
    Type Description
    Props

    Props for the ClusterSingletonManager.

    | Edit this page View Source

    Props(Props, object, ClusterSingletonManagerSettings)

    Creates props for the current cluster singleton manager.

    Declaration
    public static Props Props(Props singletonProps, object terminationMessage, ClusterSingletonManagerSettings settings)
    Parameters
    Type Name Description
    Props singletonProps

    Props of the singleton actor instance.

    object terminationMessage

    When handing over to a new oldest node this terminationMessage is sent to the singleton actor to tell it to finish its work, close resources, and stop. The hand-over to the new oldest node is completed when the singleton actor is terminated. Note that PoisonPill is a perfectly fine terminationMessage if you only need to stop the actor.

    ClusterSingletonManagerSettings settings

    Cluster singleton manager settings.

    Returns
    Type Description
    Props

    Props for the ClusterSingletonManager.

    Implements

    IInternalActor
    IListeners

    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