Skip to content

Interface: WorkerOptions ​

Defined in: glide-mq/src/types.ts:124

Configuration options for creating a Worker instance. Extends QueueOptions.

Extends ​

Extended by ​

Properties ​

backoffStrategies? ​

ts
backoffStrategies?: Record<string, (attemptsMade, err) => number>;

Defined in: glide-mq/src/types.ts:156


batch? ​

ts
batch?: BatchOptions;

Defined in: glide-mq/src/types.ts:164

Enable batch processing. When set, the processor receives an array of jobs.


blockTimeout? ​

ts
blockTimeout?: number;

Defined in: glide-mq/src/types.ts:137

XREADGROUP BLOCK timeout in ms. A graceful close() of an idle worker waits up to this long for the in-flight read to return, so no job is claimed by a closed consumer.


client? ​

ts
client?: Client;

Defined in: glide-mq/src/types.ts:85

Pre-existing GLIDE client for non-blocking commands. When provided, the component does NOT own this client - close() will not destroy it. Must not be used for blocking reads (XREADGROUP BLOCK / XREAD BLOCK).

Inherited from ​

QueueOptions.client


commandClient? ​

ts
commandClient?: Client;

Defined in: glide-mq/src/types.ts:131

Pre-existing GLIDE client for non-blocking commands (alias for client). The blocking client for XREADGROUP is always auto-created from connection. connection is required even when this is set. Provide either commandClient or client, not both.


compression? ​

ts
compression?: "gzip" | "none";

Defined in: glide-mq/src/types.ts:94

Enable transparent compression of job data. Default: 'none'.

Inherited from ​

QueueOptions.compression


concurrency? ​

ts
concurrency?: number;

Defined in: glide-mq/src/types.ts:132


connection? ​

ts
connection?: ConnectionOptions;

Defined in: glide-mq/src/types.ts:79

Connection options for creating a new client. Required unless client is provided.

Inherited from ​

QueueOptions.connection


deadLetterQueue? ​

ts
deadLetterQueue?: DeadLetterQueueOptions;

Defined in: glide-mq/src/types.ts:92

Dead letter queue configuration. On a Worker, jobs that fail terminally are copied to this queue. On a Queue, it only records the DLQ name for getDeadLetterJobs() and routes nothing.

Inherited from ​

QueueOptions.deadLetterQueue


events? ​

ts
events?: boolean;

Defined in: glide-mq/src/types.ts:169

Emit events to Valkey event stream on job completion/failure/retry/activation. Default: true. Set to false to skip XADD events in hot path (~1 fewer redis.call per job). 'failed', 'retrying' and 'stalled' stream events are still written. TS-side EventEmitter ('completed', 'failed', etc.) is unaffected.

Overrides ​

QueueOptions.events


globalConcurrency? ​

ts
globalConcurrency?: number;

Defined in: glide-mq/src/types.ts:133


limiter? ​

ts
limiter?: object;

Defined in: glide-mq/src/types.ts:141

duration ​

ts
duration: number;

max ​

ts
max: number;

lockDuration? ​

ts
lockDuration?: number;

Defined in: glide-mq/src/types.ts:160

Lock duration in ms. The worker sends a heartbeat every lockDuration/2. Jobs with a recent heartbeat are not reclaimed as stalled. Default: 30000 (30s).


maxStalledCount? ​

ts
maxStalledCount?: number;

Defined in: glide-mq/src/types.ts:139


metrics? ​

ts
metrics?: boolean;

Defined in: glide-mq/src/types.ts:172

Record per-minute timing metrics in Valkey on job completion and failure. Default: true. Set to false to skip HINCRBY metrics recording (~1-2 fewer redis.call per job).


prefetch? ​

ts
prefetch?: number;

Defined in: glide-mq/src/types.ts:135

XREADGROUP COUNT per poll. Capped at concurrency (concurrency * batch.size in batch mode); only a lower value changes behavior.


prefix? ​

ts
prefix?: string;

Defined in: glide-mq/src/types.ts:86

Inherited from ​

QueueOptions.prefix


promotionInterval? ​

ts
promotionInterval?: number;

Defined in: glide-mq/src/types.ts:140


sandbox? ​

ts
sandbox?: SandboxOptions;

Defined in: glide-mq/src/types.ts:162

Sandbox options for file-path processors. Only used when processor is a string.


serializer? ​

ts
serializer?: Serializer;

Defined in: glide-mq/src/types.ts:103

Custom serializer for job data and return values. Default: JSON.

Important: The same serializer must be used across all Queue, Worker, and FlowProducer instances that operate on the same queue. A mismatch causes silent data corruption - the consumer will see {} and the job's deserializationFailed flag will be true.

Inherited from ​

QueueOptions.serializer


stalledInterval? ​

ts
stalledInterval?: number;

Defined in: glide-mq/src/types.ts:138


tokenLimiter? ​

ts
tokenLimiter?: object;

Defined in: glide-mq/src/types.ts:145

Token-per-minute rate limiting. Tracks total tokens consumed per time window. Worker pauses fetching when either RPM limiter or TPM tokenLimiter is exceeded. Tokens reported via job.reportTokens() or auto-extracted from job.reportUsage().

duration ​

ts
duration: number;

Window duration in milliseconds.

maxTokens ​

ts
maxTokens: number;

Max tokens per window.

scope? ​

ts
scope?: "queue" | "worker" | "both";

Enforcement scope. Default: 'both'.

  • 'queue': Valkey counter shared across all workers.
  • 'worker': In-memory counter per worker.
  • 'both': Local check first, then Valkey (optimal).

Released under the Apache-2.0 License.