Aller au contenu
Français

ActorSelection

Ce contenu n’est pas encore disponible dans votre langue.

Defined in: src/ActorSelection.ts:23

A lookup handle for a logical actor path. Unlike ActorRef, which is a direct handle to a known actor, an ActorSelection is a description of where to look — resolving it walks this system’s actor tree.

Local only. This line used to promise “or issues a remote lookup”, and it never did: both resolveOne and tell call system._resolvePath directly, and nothing in src/ puts a selection on the wire (#877). The remote equivalent is the to path on a cluster envelope, which Cluster.dispatchEnvelope resolves — and which actor-ts.remote.untrusted-mode plus trusted-selection-paths are the allow-list for.

For v1 we support exact paths only (no * wildcards). Messages tell()‘d to a selection are delivered synchronously to the first matching actor if it resolves immediately; otherwise they land in dead letters.

new ActorSelection(system, pathSegments, pathString): ActorSelection

Defined in: src/ActorSelection.ts:24

ActorSystem

readonly string[]

Segments relative to the root, guardian included — so ['user', 'foo', 'bar'] for a user actor and ['system', 'cluster', 'receptionist'] for a framework one.

string

Printable form, convenient for logging.

ActorSelection

readonly pathSegments: readonly string[]

Defined in: src/ActorSelection.ts:31

Segments relative to the root, guardian included — so ['user', 'foo', 'bar'] for a user actor and ['system', 'cluster', 'receptionist'] for a framework one.


readonly pathString: string

Defined in: src/ActorSelection.ts:33

Printable form, convenient for logging.

resolveOne(timeoutMs?): Promise<ActorRef<unknown>>

Defined in: src/ActorSelection.ts:41

Resolve to a concrete ActorRef. Retries until timeoutMs elapses if the intermediate cell is in the process of starting (so tests that race spawn+selection are stable). Rejects with an Error on timeout.

number = 1_000

Promise<ActorRef<unknown>>


tell(message, sender?): void

Defined in: src/ActorSelection.ts:57

Fire-and-forget: resolve immediately; if no match, drop to dead letters. For cases where you want asynchronous retry, use resolveOne(...).then(r => r.tell(...)).

unknown

ActorRef<unknown> | null = null

void


toString(): string

Defined in: src/ActorSelection.ts:70

string