Zum Inhalt springen
Deutsch

ActorRef

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Defined in: src/ActorRef.ts:23

Handle to an actor. The only way to interact with an actor — you never hold a direct reference to the Actor instance itself. tell() is fire-and- forget; ask() provides a request/response Promise.

TMsg = unknown

new ActorRef<TMsg>(): ActorRef<TMsg>

ActorRef<TMsg>

abstract readonly path: ActorPath

Defined in: src/ActorRef.ts:24

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>


equals(other): boolean

Defined in: src/ActorRef.ts:67

ActorRef

boolean


kill(): void

Defined in: src/ActorRef.ts:63

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

void


send(message): void

Defined in: src/ActorRef.ts:30

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

TMsg

void


stop(): void

Defined in: src/ActorRef.ts:60

Gracefully stop this actor after it drains its mailbox.

void


abstract tell(message, sender?): void

Defined in: src/ActorRef.ts:27

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

TMsg

ActorRef<unknown> | null

void


toString(): string

Defined in: src/ActorRef.ts:65

string