콘텐츠로 이동
한국어

ActorRef

이 콘텐츠는 아직 번역되지 않았습니다.

Defined in: src/ActorRef.ts:108

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.

TMessage = unknown

new ActorRef<TMessage>(): ActorRef<TMessage>

ActorRef<TMessage>

abstract readonly path: ActorPath

Defined in: src/ActorRef.ts:109

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

Defined in: src/ActorRef.ts:133

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' });

timeoutMs must be a positive finite number; omit it to get DEFAULT_ASK_TIMEOUT_MS. 0, a negative value, NaN and Infinity throw OptionsError — see assertAskTimeout for why an ask has no “no deadline” mode.

TResponse = unknown

OmitReplyTo<TMessage>

number = DEFAULT_ASK_TIMEOUT_MS

Promise<TResponse>


equals(other): boolean

Defined in: src/ActorRef.ts:172

ActorRef

boolean


kill(): void

Defined in: src/ActorRef.ts:168

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

void


send(message): void

Defined in: src/ActorRef.ts:115

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

TMessage

void


stop(): void

Defined in: src/ActorRef.ts:165

Gracefully stop this actor after it drains its mailbox.

void


abstract tell(message, sender?): void

Defined in: src/ActorRef.ts:112

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

TMessage

ActorRef<unknown> | null

void


toString(): string

Defined in: src/ActorRef.ts:170

string