ClusterSingletonManager
Defined in: src/cluster/singleton/ClusterSingletonManager.ts:73
Runs on every node. Watches cluster events and (re)spawns the singleton child when this node is the cluster leader; stops the child when it is not. Remote Envelopes addressed to the singleton land here and are forwarded to the child — if the manager is not on the leader node, the envelope is dropped with a warning (the proxy shouldn’t have forwarded there).
Two paths:
- No lease (default). Synchronous reconcile — spawn the moment cluster gossip says we’re leader. Same behaviour the manager has shipped since v1.
- With lease. Async reconcile that gates child-spawn on
lease.acquire(), watcheslease.onLost(...)for revocation, andrelease()s on graceful handover. All state transitions go through the manager’s own mailbox so concurrent cluster events can’t race with an in-flight acquire.
Extends
Section titled “Extends”Actor<Inbox>
Type Parameters
Section titled “Type Parameters”T
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ClusterSingletonManager<
T>(settings):ClusterSingletonManager<T>
Defined in: src/cluster/singleton/ClusterSingletonManager.ts:99
Parameters
Section titled “Parameters”settings
Section titled “settings”ClusterSingletonManagerSettings<T>
Returns
Section titled “Returns”ClusterSingletonManager<T>
Overrides
Section titled “Overrides”Properties
Section titled “Properties”_envelopeUnsub
Section titled “_envelopeUnsub”_envelopeUnsub: (() =>
void) |null=null
Defined in: src/cluster/singleton/ClusterSingletonManager.ts:97
Callback the extension hands us so we can release the envelope path on stop.
settings
Section titled “settings”
readonlysettings:ClusterSingletonManagerSettings<T>
Defined in: src/cluster/singleton/ClusterSingletonManager.ts:99
Methods
Section titled “Methods”onReceive()
Section titled “onReceive()”onReceive(
msg):void|Promise<void>
Defined in: src/cluster/singleton/ClusterSingletonManager.ts:159
Main message handler. Receives each envelope dequeued from the mailbox. A thrown error (sync or async) is caught by the supervisor.
Parameters
Section titled “Parameters”Inbox
Returns
Section titled “Returns”void | Promise<void>
Overrides
Section titled “Overrides”postRestart()
Section titled “postRestart()”postRestart(
_reason):void|Promise<void>
Defined in: src/Actor.ts:55
Called on the fresh instance after a restart. Default: call preStart().
Parameters
Section titled “Parameters”_reason
Section titled “_reason”Error
Returns
Section titled “Returns”void | Promise<void>
Inherited from
Section titled “Inherited from”postStop()
Section titled “postStop()”postStop():
Promise<void>
Defined in: src/cluster/singleton/ClusterSingletonManager.ts:141
Called after the actor has been terminated. Children are already stopped.
Returns
Section titled “Returns”Promise<void>
Overrides
Section titled “Overrides”preRestart()
Section titled “preRestart()”preRestart(
_reason,_message?):void|Promise<void>
Defined in: src/Actor.ts:50
Called before a restart, on the instance about to be thrown away. The default stops children and then calls postStop().
Parameters
Section titled “Parameters”_reason
Section titled “_reason”Error
_message?
Section titled “_message?”Inbox
Returns
Section titled “Returns”void | Promise<void>
Inherited from
Section titled “Inherited from”preStart()
Section titled “preStart()”preStart():
void
Defined in: src/cluster/singleton/ClusterSingletonManager.ts:101
Called after construction and before the first message is processed.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”supervisorStrategy()
Section titled “supervisorStrategy()”supervisorStrategy():
SupervisorStrategy
Defined in: src/Actor.ts:63
Supervisor strategy for this actor’s children. Defaults to restart, up to 10 times per minute, then stop.