コンテンツにスキップ
日本語

ClusterSingletonProxy

このコンテンツはまだ日本語訳がありません。

Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:20

Location-transparent handle to a cluster-wide singleton. Every call to tell looks up the current leader and forwards to that node’s ClusterSingletonManager (via direct tell if local, via envelope if remote). Messages sent before the cluster has elected a leader are buffered and drained when the first LeaderChanged event fires.

The proxy extends ActorRef so it can be passed anywhere an ActorRef is expected (e.g. as a sender for ask patterns). It is not backed by a real actor — it is a thin forwarder.

T

new ClusterSingletonProxy<T>(cluster, typeName, localManagerRef): ClusterSingletonProxy<T>

Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:26

Cluster

string

ActorRef

ClusterSingletonProxy<T>

ActorRef.constructor

readonly path: ActorPath

Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:21

ActorRef.path

ask<TRes>(message, timeoutMs?): Promise<TRes>

Defined in: src/ActorRef.ts:43

Request/response — send message and await the recipient’s reply. The framework synthesises a one-shot reply ref, injects it as both the sender slot and as message.replyTo, and resolves the returned promise with the first reply (or rejects with AskTimeoutError).

The caller never specifies replyTo on the message — the OmitReplyTo type subtracts it from the parameter type if the recipient declares it.

const value = await counter.ask<number>({ kind: 'get' });

TRes = unknown

OmitReplyTo<T>

number = 5_000

Promise<TRes>

ActorRef.ask


equals(other): boolean

Defined in: src/ActorRef.ts:67

ActorRef

boolean

ActorRef.equals


hasPending(): boolean

Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:61

True if at least one message is currently buffered.

boolean


kill(): void

Defined in: src/ActorRef.ts:63

Kill this actor — raises ActorKilledError through the normal supervision path.

void

ActorRef.kill


send(message): void

Defined in: src/ActorRef.ts:30

Alias for tell — useful if you want to pipe something.

T

void

ActorRef.send


stop(): void

Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:54

Stop forwarding; unsubscribes from cluster events.

void

ActorRef.stop


tell(message, _sender?): void

Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:43

Send a message to this actor. sender is surfaced as context.sender in the recipient.

T

ActorRef<unknown> | null

void

ActorRef.tell


toString(): string

Defined in: src/ActorRef.ts:65

string

ActorRef.toString