Optional ReadonlyappProcess-unique Worker ID; defaults to host identity plus eight random base32 characters. Use a new ID after every restart. Values contain 1-63 ASCII letters, digits, dots, underscores, or hyphens and cannot equal a registered Flow type.
Optional ReadonlyidleLegacy per-queue idle stream option; zero or omission formerly used one. Still accepts nonnegative integers; invalid values throw RangeError.
Optional ReadonlymaxNumber of execution slots, each represented by one long-lived poll stream. Zero or omission uses the logical CPU count. Negative values are invalid. Worker.start fails if this exceeds the Server per-Worker limit, matching.maxConcurrentTasksCap.
Optional ReadonlyreservedNumber of long-lived slots that accept only RPCs. Unset reserves one slot when maxConcurrentTasks resolves to at least two, otherwise zero. Set zero to let every slot accept Steps and RPCs. Steps are never declined for capacity. With one slot and no explicit reserve, start warns once that RPCs may wait behind Steps. Requires an integer at least zero and less than maxConcurrentTasks; construction throws RangeError otherwise. RPCs can use shared slots and reserved slots. Reservation is capacity, not a latency guarantee.
Optional ReadonlystopMilliseconds allowed for graceful shutdown and busy Reconnect final-frame delivery; defaults to 30000. Requires a non-negative finite value; zero selects the default. On stop, idle streams half-close immediately; busy streams send final output before half-closing. Tasks arriving after stop begins are dropped. Half-closed streams keep reading until the Server ends them. On expiry, streams whose handler has not written final output are reset and their handlers canceled; close waits for handlers to return. A handler whose final output is written still half-closes. Half-closed streams without Server EOF are reset at the deadline. A stream whose final output the Server has not yet confirmed gets 5 more seconds, so close can return that much later. A Server-requested reconnect uses the same timeout and grace. Dex treats a task dropped on such a reset stream as possibly run.
Optional ReadonlystopStops and drains the Worker when a permanent rejection leaves a slot kind without registered streams. Defaults to false, retrying indefinitely. Worker.run rejects with PullRegistrationError after draining; Worker.start waits for the first successful registration and the Server concurrency-limit check.
Configures an outbound pull Worker.
Pass this as
WorkerOptions.pullto customize task capacity and shutdown. Each stream handles one task, while handlers on different streams can run concurrently.Example