Skip to content

WorkerCluster

Defined in: src/worker/WorkerCluster.ts:61

Spawn a pool of workers and wire them into a shared broker via their native postMessage channel. Each worker hosts its own ActorSystem + Cluster; the broker routes BrokeredMessages between workers based on the envelope’s to address.

The underlying Worker implementation is picked per runtime — Bun and Deno use the Web Worker API, Node.js uses node:worker_threads — via getWorkerBackend(). The cluster code itself never branches on runtime; it only ever sees a runtime-neutral WorkerLike.

readonly broker: WorkerBroker

Defined in: src/worker/WorkerCluster.ts:62

get addresses(): NodeAddress[]

Defined in: src/worker/WorkerCluster.ts:95

NodeAddress[]


get size(): number

Defined in: src/worker/WorkerCluster.ts:96

number

terminate(): Promise<void>

Defined in: src/worker/WorkerCluster.ts:98

Promise<void>


static spawn(settings): Promise<WorkerCluster>

Defined in: src/worker/WorkerCluster.ts:87

WorkerClusterSettings

Promise<WorkerCluster>