Skip to content
Français

createBullMQTaskQueue

import { createBullMQTaskQueue } from "@elie-laloum/outpost/queues/bullmq";

Open a TaskQueue on standalone Redis through BullMQ 5; import it from @elie-laloum/outpost/queues/bullmq and install bullmq separately. Rejects a server whose maxmemory-policy is not noeviction, without changing its configuration. The queue owns its Redis connections: stop the workers, then await close().

Complete example and detailed rules.

  • optionsRequired
    BullMQTaskQueueOptions
    Redis connection settings and the stable namespace shared by producers and workers.
  • options.nameRequired
    string
    Logical queue name shared by all clients; hashed internally, so colons and Unicode are supported. Different names isolate job identities.
  • options.connectionRequired
    RedisOptions
    RedisOptions for standalone Redis (host, port, db, username, password, tls), not a live client. Connect and command timeouts default to 10000; keyPrefix is rejected, use prefix instead.
  • options.prefixOptional
    string | undefined
    Redis key prefix, default outpost. Keep it stable across restarts and identical on every client; use a dedicated namespace without external BullMQ consumers or cleanup.
  • options.stalledIntervalMsOptional
    number | undefined
    Positive interval in milliseconds between BullMQ stalled-job checks, default 1000. Reclaiming an expired lease may require two checks; this is separate from leaseMs and pollMs.
  • options.onErrorOptional
    ((error: Error) => void) | undefined
    Synchronous observer for connection, stalled-check and BullMQ finalization errors; its exceptions are ignored. Queue operations still reject on their own failures.

Promise<BullMQTaskQueue>

export declare function createBullMQTaskQueue(
  options: BullMQTaskQueueOptions,
): Promise<BullMQTaskQueue>;