Integrations

BullMQ Integration

Connect Queuedash to your BullMQ queues.

BullMQ is our recommended queue library. The SDK needs BullMQ 5 or later. For each queue you attach, it creates a BullMQ QueueEvents listener, so it hears about jobs from all your workers, wherever you attach it. Jobs already in the queue when you attach aren't sent; the SDK sends a job when it hears an event for it.

Attach a queue

import { Queue } from "bullmq";
import { Queuedash } from "@queuedash/sdk";
 
const qd = new Queuedash({
  apiKey: process.env.QUEUEDASH_API_KEY,
});
 
// Initialize your queue and attach it
const myQueue = new Queue("my-queue", {
  connection: { host: "localhost", port: 6379 },
});
 
qd.attach(myQueue);

Attach the Queue, not a Worker. Attaching a Worker logs a warning and sends nothing.

Multiple queues

import { Queue } from "bullmq";
import { Queuedash } from "@queuedash/sdk";
 
const connection = { host: "localhost", port: 6379 };
 
const qd = new Queuedash({
  apiKey: process.env.QUEUEDASH_API_KEY,
});
 
qd.attach(new Queue("emails", { connection }));
qd.attach(new Queue("reports", { connection }));
qd.attach(new Queue("notifications", { connection }));

Custom key prefix

The listener uses the queue's own prefix, so queues created with a custom prefix are tracked too (SDK 2.0.1 and later).

Tracked events

  • added, waiting, waiting-children, delayed
  • active, progress
  • completed, failed, retries-exhausted
  • stalled, deduplicated, removed

Shutdown

The SDK flushes on SIGTERM and SIGINT (see Configuration). You can also stop it manually:

// Close the listeners the SDK created, then flush remaining jobs
await qd.stop();

Next: configure the SDK and set up alerts.