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

RemoteActorRef

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

Defined in: src/cluster/RemoteActorRef.ts:17

A ref whose target lives on a different node. tell() builds an envelope and hands it to the cluster transport. Messages MUST be JSON-safe; classes are not preserved by default (only the tag string is sent). Any ActorRef instances embedded in the message body are rewritten to wire-safe markers inside Cluster._sendEnvelope so they can be reconstructed on the receiving node.

TMsg = unknown

new RemoteActorRef<TMsg>(targetNode, targetPath, cluster): RemoteActorRef<TMsg>

Defined in: src/cluster/RemoteActorRef.ts:20

NodeAddress

string

Cluster

RemoteActorRef<TMsg>

ActorRef.constructor

readonly path: ActorPath

Defined in: src/cluster/RemoteActorRef.ts:18

ActorRef.path


readonly targetNode: NodeAddress

Defined in: src/cluster/RemoteActorRef.ts:21


readonly targetPath: string

Defined in: src/cluster/RemoteActorRef.ts:22

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<TMsg>

number = 5_000

Promise<TRes>

ActorRef.ask


equals(other): boolean

Defined in: src/ActorRef.ts:67

ActorRef

boolean

ActorRef.equals


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.

TMsg

void

ActorRef.send


stop(): void

Defined in: src/ActorRef.ts:60

Gracefully stop this actor after it drains its mailbox.

void

ActorRef.stop


tell(message, sender?): void

Defined in: src/cluster/RemoteActorRef.ts:34

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

TMsg

ActorRef<unknown> | null

void

ActorRef.tell


toString(): string

Defined in: src/cluster/RemoteActorRef.ts:53

string

ActorRef.toString