BullMQ

Premium Message Queue for NodeJS based on Redis

README




The fastest, most reliable, Redis-based distributed queue for Node.

    Carefully written for rock solid stability and atomicity.

Read the documentation

Follow @manast for *important* Bull/BullMQ news and updates!


🛠 Tutorials


You can find tutorials and news in this blog: https://blog.taskforce.sh/

Official FrontEnd


[Taskforce.sh, Inc](https://taskforce.sh)

Supercharge your queues with a professional front end:

- Get a complete overview of all your queues.
- Inspect jobs, search, retry, or promote delayed jobs.
- Metrics and statistics.
- and many more features.

Sign up at Taskforce.sh

Used by


Some notable organizations using BullMQ:

        <img
          src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUuDmt_xXMfG66Rn1GA%2Fuploads%2FUvwInTAmk7hxAViDwJzU%2Fclipart1565701.png?alt=media"
          width="150"
          alt="Microsoft"
        />
        <img
          src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUuDmt_xXMfG66Rn1GA%2Fuploads%2FvT30DUqsi61gL8edn3R2%2Fwordmark-logo.png?alt=media"
          width="150"
          alt="Vendure"
        />
        <img
          src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUuDmt_xXMfG66Rn1GA%2Fuploads%2FCJ5XmotpBBsuSgD8CilC%2Fdatawrapper-logo.png?alt=media"
          width="150"
          alt="Datawrapper"
        />
        <img
          src="https://user-images.githubusercontent.com/659829/161662129-ae645bc4-c1e9-48ff-997e-4cee281a964a.png"
          width="150"
          alt="Curri"
        />
        <img
          src="https://super-static-assets.s3.amazonaws.com/1e9f5a51-c4c6-4fca-b6e8-25fa0186f139/images/4052d2f1-dc73-4421-984c-cdd02e989fdb.png"
          width="150"
          alt="Curri"
        />
        <img
          src="https://www.nocodb.com/brand/logo-text.png"
          width="150"
          alt="NoCodeDB"
        />

The gist


Install:

  1. ```
  2. $ yarn add bullmq
  3. ```

Add jobs to the queue:

  1. ```ts
  2. import { Queue } from 'bullmq';

  3. const queue = new Queue('Paint');

  4. queue.add('cars', { color: 'blue' });
  5. ```

Process the jobs in your workers:

  1. ```ts
  2. import { Worker } from 'bullmq';

  3. const worker = new Worker('Paint', async job => {
  4.   if (job.name === 'cars') {
  5.     await paintCar(job.data.color);
  6.   }
  7. });
  8. ```

Listen to jobs for completion:

  1. ```ts
  2. import { QueueEvents } from 'bullmq';

  3. const queueEvents = new QueueEvents('Paint');

  4. queueEvents.on('completed', ({ jobId }) => {
  5.   console.log('done painting');
  6. });

  7. queueEvents.on('failed', ({ jobId, failedReason }: { jobId: string, failedReason: string }) => {
  8.   console.error('error painting', failedReason);
  9. });
  10. ```

This is just scratching the surface, check all the features and more in the official documentation

Feature Comparison


Since there are a few job queue solutions, here is a table comparing them:

| Feature                   |   BullMQ-Pro    |     BullMQ      |      Bull       |  Kue  | Bee      | Agenda |
| :------------------------ | :-------------: | :-------------: | :-------------: | :---: | -------- | ------ |
| Backend                   |      redis      |      redis      |      redis      | redis | redis    | mongo  |
| Observables               |        ✓        |                 |                 |       |          |        |
| Group Rate Limit          |        ✓        |                 |                 |       |          |        |
| Group Support             |        ✓        |                 |                 |       |          |        |
| Parent/Child Dependencies |        ✓        |        ✓        |                 |       |          |        |
| Priorities                |        ✓        |        ✓        |        ✓        |   ✓   |          | ✓      |
| Concurrency               |        ✓        |        ✓        |        ✓        |   ✓   | ✓        | ✓      |
| Delayed jobs              |        ✓        |        ✓        |        ✓        |   ✓   |          | ✓      |
| Global events             |        ✓        |        ✓        |        ✓        |   ✓   |          |        |
| Rate Limiter              |        ✓        |        ✓        |        ✓        |       |          |        |
| Pause/Resume              |        ✓        |        ✓        |        ✓        |   ✓   |          |        |
| Sandboxed worker          |        ✓        |        ✓        |        ✓        |       |          |        |
| Repeatable jobs           |        ✓        |        ✓        |        ✓        |       |          | ✓      |
| Atomic ops                |        ✓        |        ✓        |        ✓        |       | ✓        |        |
| Persistence               |        ✓        |        ✓        |        ✓        |   ✓   | ✓        | ✓      |
| UI                        |        ✓        |        ✓        |        ✓        |   ✓   |          | ✓      |
| Optimized for             | Jobs / Messages | Jobs / Messages | Jobs / Messages | Jobs  | Messages | Jobs   |

🚀 Sponsor 🚀


Memetria for Redis

If you need high quality production Redis instances for your BullMQ project, please consider subscribing to Memetria for Redis, leaders in Redis hosting that works perfectly with BullMQ. Use the promo code "BULLMQ" when signing up to help us sponsor the development of BullMQ!

Contributing


Fork the repo, make some changes, submit a pull-request! Here is the contributing doc that has more details.

Thanks


Thanks for all the contributors that made this library possible,
also a special mention to Leon van Kammen that kindly donated
his npm bullmq repo.