Click or drag to resize
Akka.NETClusterSingletonManager Class

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 factory method Props(Props, ClusterSingletonManagerSettings) to create the Props for the actor.

Inheritance Hierarchy
SystemObject
  Akka.ActorActorBase
    Akka.ActorFSMBase
      Akka.ActorFSMClusterSingletonState, IClusterSingletonData
        Akka.Cluster.Tools.SingletonClusterSingletonManager

Namespace:  Akka.Cluster.Tools.Singleton
Assembly:  Akka.Cluster.Tools (in Akka.Cluster.Tools.dll) Version: 1.2.3.129 (1.2.3.129)
Syntax
public sealed class ClusterSingletonManager : FSM<ClusterSingletonState, IClusterSingletonData>

The ClusterSingletonManager type exposes the following members.

Constructors
  NameDescription
Public methodClusterSingletonManager
TBD
Top
Properties
Methods
  NameDescription
Public methodAroundPostRestart
Can be overridden to intercept calls to `PostRestart`. Calls `PostRestart` by default.
(Inherited from ActorBase.)
Public methodAroundPostStop
Can be overridden to intercept calls to `PostStop`. Calls `PostStop` by default..
(Inherited from ActorBase.)
Public methodAroundPreRestart
Can be overridden to intercept calls to `PreRestart`. Calls `PreRestart` by default.
(Inherited from ActorBase.)
Public methodAroundPreStart
Can be overridden to intercept calls to `PreStart`. Calls `PreStart` by default.
(Inherited from ActorBase.)
Protected methodAroundReceive
TBD
(Inherited from ActorBase.)
Protected methodBecome
Changes the actor's command behavior and replaces the current receive handler with the specified handler.
(Inherited from ActorBase.)
Protected methodBecomeStacked
Changes the actor's behavior and replaces the current receive handler with the specified handler. The current handler is stored on a stack, and you can revert to it by calling UnbecomeStacked
Remarks
Please note, that in order to not leak memory, make sure every call to BecomeStacked(Receive) is matched with a call to UnbecomeStacked.
(Inherited from ActorBase.)
Public methodCancelTimer
Cancel a named Timer, ensuring that the message is not subsequently delivered (no race.)
(Inherited from FSMTState, TData.)
Public methodStatic memberDefaultConfig
Returns default HOCON configuration for the cluster singleton.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGoTo(TState)
Produce transition to other state. Return this from a state function in order to effect the transition.
(Inherited from FSMTState, TData.)
Public methodGoTo(TState, TData) Obsolete.
Obsolete. Use GoTo(nextStateName).Using(stateData) instead.
(Inherited from FSMTState, TData.)
Public methodInitialize
Verify the existence of initial state and setup timers. This should be the last call within the constructor or PreStart and PostRestart(Exception).
(Inherited from FSMTState, TData.)
Public methodIsTimerActive
Determines whether the named timer is still active. Returns true unless the timer does not exist, has previously been cancelled, or if it was a single-shot timer whose message was already received.
(Inherited from FSMTState, TData.)
Protected methodLogTermination
By default, Failure is logged at error level and other reason types are not logged. It is possible to override this behavior.
(Inherited from FSMTState, TData.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodOnTermination
Set the handler which is called upon termination of this FSM actor. Calling this method again will overwrite the previous contents.
(Inherited from FSMTState, TData.)
Public methodOnTransition
Set handler which is called upon each state transition
(Inherited from FSMTState, TData.)
Protected methodPostRestart
User overridable callback: By default it calls `PreStart()`.

Is called right AFTER restart on the newly created Actor to allow reinitialization after an Actor crash.

(Inherited from ActorBase.)
Protected methodPostStop
User overridable callback.

Is called asynchronously after 'actor.stop()' is invoked. Empty default implementation.

(Overrides FSMTState, TDataPostStop.)
Protected methodPreRestart
User overridable callback: '''By default it disposes of all children and then calls `postStop()`.'''

Is called on a crashed Actor right BEFORE it is restarted to allow clean up of resources before Actor is terminated.

(Inherited from ActorBase.)
Protected methodPreStart
User overridable callback.

Is called when an Actor is started. Actors are automatically started asynchronously when created. Empty default implementation.

(Overrides ActorBasePreStart.)
Public methodStatic memberProps(Props, ClusterSingletonManagerSettings)
Creates props for the current cluster singleton manager using PoisonPill as the default termination message.
Public methodStatic memberProps(Props, Object, ClusterSingletonManagerSettings)
Creates props for the current cluster singleton manager.
Protected methodReceive
Processor for user defined messages.
(Inherited from FSMTState, TData.)
Protected methodSetReceiveTimeout

Defines the inactivity timeout after which the sending of a ReceiveTimeout message is triggered. When specified, the receive function should be able to handle a ReceiveTimeout message.

Please note that the receive timeout might fire and enqueue the ReceiveTimeout message right after another message was enqueued; hence it is not guaranteed that upon reception of the receive timeout there must have been an idle period beforehand as configured via this method.

Once set, the receive timeout stays in effect (i.e. continues firing repeatedly after inactivity periods). Pass in null to switch off this feature.

(Inherited from ActorBase.)
Public methodSetStateTimeout
Set the state timeout explicitly. This method can be safely used from within a state handler.
(Inherited from FSMTState, TData.)
Public methodSetTimer
Schedule named timer to deliver message after given delay, possibly repeating. Any existing timer with the same name will automatically be canceled before adding the new timer.
(Inherited from FSMTState, TData.)
Public methodStartWith
Sets the initial state for this FSM. Call this method from the constructor before the Initialize method. If different state is needed after a restart this method, followed by Initialize, can be used in the actor life cycle hooks PreStart and PostRestart(Exception).
(Inherited from FSMTState, TData.)
Public methodStay
Produce "empty" transition descriptor. Return this from a state function when no state change is to be effected.
(Inherited from FSMTState, TData.)
Public methodStop (Inherited from FSMTState, TData.)
Public methodStop(FSMBaseReason)
Produce change descriptor to stop this FSM actor with the specified FSMBaseReason.
(Inherited from FSMTState, TData.)
Public methodStop(FSMBaseReason, TData)
Produce change descriptor to stop this FSM actor with the specified FSMBaseReason.
(Inherited from FSMTState, TData.)
Protected methodSupervisorStrategy
TBD
(Inherited from ActorBase.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTransform
TBD
(Inherited from FSMTState, TData.)
Protected methodUnbecomeStacked
Reverts the Actor behavior to the previous one on the behavior stack.
(Inherited from ActorBase.)
Protected methodUnhandled
Is called when a message isn't handled by the current behavior of the actor by default it fails with either a DeathPactException (in case of an unhandled Terminated message) or publishes an UnhandledMessage to the actor's system's EventStream
(Inherited from ActorBase.)
Public methodWhen (Inherited from FSMTState, TData.)
Public methodWhenUnhandled
Set handler which is called upon reception of unhandled FSM messages. Calling this method again will overwrite the previous contents.
(Inherited from FSMTState, TData.)
Top
Fields
Extension Methods
See Also