Skip to content
Get started
Get started
WorkerOptions Reference
guide · worker

Every knob, with its default.

The complete option surface for a Worker, what each one changes, and the defaults you get when you leave it alone.

const worker = new Worker('queue', processor, {
embedded: true,
concurrency: 5,
batchSize: 100, // Pull up to 100 jobs per request
pollTimeout: 5000, // Long-poll: wait up to 5s for jobs instead of busy polling
limiter: { max: 10, duration: 1000 }, // Max 10 jobs per second
});

The table below documents the Bun client’s options; the external SDK worker options are tabulated in the SDK guide.

OptionTypeDefaultDescription
embeddedbooleanfalseUse in-process mode
concurrencynumber1Parallel job processing
autorunbooleantrueStart polling automatically
heartbeatIntervalnumber10000Heartbeat interval in ms (0 = disabled)
batchSizenumber10Jobs to pull per batch (max: 1000)
pollTimeoutnumber0Long-poll timeout in ms (max: 30000)
useLocksbooleantrueEnable BullMQ-style job locks
limiter{ max, duration, groupKey? }-Without groupKey: max job starts per rolling window, acquired atomically even with concurrent or manual processing. With groupKey: per-group concurrency cap of max (jobs grouped by job.data[groupKey], duration unused)
lockDurationnumber30000Job lock TTL in ms
maxStalledCountnumber1Accepted for BullMQ compatibility, but not applied by the Worker. Configure the broker’s per-queue maxStalls policy with Queue.setStallConfig() or the HTTP API instead
skipStalledCheckbooleanfalseIn embedded or TCP mode, skip only this Worker’s subscription to stalled notifications. It does not disable broker-side stall detection or recovery
skipLockRenewalbooleanfalseSkip lock renewal via heartbeat
drainDelaynumber50Delay between polls when the queue is empty (ms)
removeOnCompleteboolean | number | KeepJobsfalseAuto-remove completed jobs. Only true is honored; number / { age?, count? } are accepted for BullMQ type compatibility but treated as false
removeOnFailboolean | number | KeepJobsfalseSame behavior as removeOnComplete (boolean only)
connectionConnectionOptions-TCP connection (host, port, token, poolSize)
prefixKeystring-Namespace prefix; must match the producing Queue’s. See Namespace Isolation

Connection pool sizing (TCP): when poolSize is not set, it defaults to min(concurrency, 8). Override it by setting poolSize explicitly.

WorkerCreate a worker and process your first job
Worker Concurrency and Batch PullingRun jobs in parallel and pull them in batches
The Job Object Inside a Worker ProcessorEverything the processor receives and can do
Worker Eventscompleted, failed, stalled and the rest
Worker Error Handling, Retries and BackoffRetries, backoff, timeouts and giving up
Worker LifecyclePause, resume and shut down without losing work
Heartbeats, Stall Detection and Lock OwnershipHeartbeats, stall recovery and lock ownership
SandboxedWorkerExperimental isolation for CPU-heavy handlers