Interface EnqueueOptions

    Per-enqueue overrides. All fields optional.

    interface EnqueueOptions {
        delayMs?: number;
        groupKey?: string;
        maxAttempts?: number;
        maxStalledCount?: number;
        metadata?: any;
        priority?: number;
        queue?: string;
        removeOnComplete?: number | boolean | { age?: number; count?: number };
        removeOnFail?: number | boolean | { age?: number; count?: number };
        scheduledAtMs?: number;
        tags?: string[];
        uniqueKey?: string;
    }
    Index

    Properties

    delayMs?: number

    Convenience: delay this job by N milliseconds relative to now. Computed server-side at enqueue time. Mutually exclusive with scheduledAtMs.

    groupKey?: string

    Group key for per-group concurrency / rate limiting.

    maxAttempts?: number

    Max total attempts before the job is marked failed. Default 3.

    maxStalledCount?: number

    Max number of stall recoveries (worker-lost rescues) before the job is moved to failed. Distinct from maxAttempts so a pod kill mid-handler doesn't burn the handler-throw retry budget. Default 1 — one free recovery, then fail.

    metadata?: any

    Arbitrary JSON metadata attached to the job (not passed to the handler).

    priority?: number

    Priority (higher runs first). Default 0.

    queue?: string

    Named queue to land this job on. Default "default".

    removeOnComplete?: number | boolean | { age?: number; count?: number }

    removeOnComplete: true (drop on finalize) | false (keep forever) | number (keep last N) | { age?: seconds; count?: N }. Redis-only — Postgres ignores per-job rules and uses its cleanup tick.

    removeOnFail?: number | boolean | { age?: number; count?: number }

    removeOnFail. Same shape as removeOnComplete.

    scheduledAtMs?: number

    Run no earlier than this time (epoch milliseconds). Default now. Mutually exclusive with delayMs — set one or the other.

    tags?: string[]

    Admin-visible tags.

    uniqueKey?: string

    Unique key — duplicate enqueues with the same key are silently skipped.