Constructs a Worker without starting its task streams. Workers need only an outbound connection to the Dex Server.
Flow definitions served by this Worker.
Open cache used to hydrate large handler values.
Server connectivity, task capacity, bearer credential, and startup settings; uses local defaults when omitted.
ReadonlyblobOpen cache used to hydrate large handler values.
ReadonlyoptionsServer connectivity, task capacity, bearer credential, and startup settings; uses local defaults when omitted.
ReadonlyregistryFlow definitions served by this Worker.
Cumulative Step declines caused by reserved RPC capacity during this Worker's lifetime. Counts decline events. Dex may decline the same Step dispatch repeatedly while retrying it, so read the counter as a rate. Excludes full-capacity rejections and unknown names. The count never resets and remains available after close. Reading during handler execution is safe. Export the value to a monitoring counter.
The cumulative reserve-decline count.
Gracefully drains tasks, then releases connections.
A pull Worker force-cancels after its drain timeout and waits for handlers to return.
Half-closed pull streams wait for server EOF until the remaining drain deadline.
Calls before start and repeated calls after shutdown are safe.
Returns an independent snapshot of pull queue registrations. Readiness latches after every queue registers once. Only a permanent rejection with no registered stream makes it false; re-registration clears the queue error. Stop preserves readiness.
Current readiness and queue snapshots. See waitPullRegistered for a startup and readiness example. Treat errors as immutable.
Negotiates the Server protocol, synchronizes indexes, and starts polling. The promise resolves after launching pull streams; call exactly once. Await waitPullRegistered separately to gate startup on pull queue acknowledgements.
Waits until every Flow type queue and the app Worker ID queue has registered at least once. Safe before or after start and for concurrent callers. Later calls resolve even after shutdown. Reconnects do not reset completion. Use pullRegistrationState for ongoing readiness probes.
Optional AbortSignal and positive timeout in milliseconds; defaults to waiting indefinitely.
A promise resolved after all queues have registered once.
Hosts registered Step and RPC handlers through outbound pull streams.
A Worker is one-shot. Call
startfor non-blocking startup orrunto await shutdown, then callclose. Concurrent handlers must synchronize shared state.closedrains forstopDrainTimeoutMs, then cancels handlers and waits for them to return. Half-closed streams wait for server EOF until the remaining drain deadline. A handler that ignores cancellation can delay shutdown.Example