Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
B

bull

> 编程语言
Open source

Premium Queue package for handling distributed jobs and messages in NodeJS.

16.2K stars0 likes6 views
WebsiteGitHub

About

Premium Queue package for handling distributed jobs and messages in NodeJS.

🚀 Sponsors 🚀

  </a>
</td>
<td>
  Dragonfly is a new Redis™ drop-in replacement that is fully compatible with BullMQ and brings some important advantages over Redis™ such as massive
  better performance by utilizing all CPU cores available and faster and more memory efficient data structures. Read more <a href="https://www.dragonflydb.io/docs/integrations/bullmq">here</a> on how to use it with BullMQ.
</td>

📻 News and updates

Bull is currently in maintenance mode, we are only fixing bugs. For new features check BullMQ, a modern rewritten implementation in Typescript. You are still very welcome to use Bull if it suits your needs, which is a safe, battle tested library.

Follow me on Twitter for other important news and updates.

🛠 Tutorials

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


Used by

Bull is popular among large and small organizations, like the following ones:



Official FrontEnd

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


Bull Features

  • Minimal CPU usage due to a polling-free design.
  • Robust design based on Redis.
  • Delayed jobs.
  • Schedule and repeat jobs according to a cron specification.
  • Rate limiter for jobs.
  • Retries.
  • Priority.
  • Concurrency.
  • Pause/resume—globally or locally.
  • Multiple job types per queue.
  • Threaded (sandboxed) processing functions.
  • Automatic recovery from process crashes.

And coming up on the roadmap...

  • Job completion acknowledgement (you can use the message queue pattern in the meantime).
  • Parent-child jobs relationships.

UIs

There are a few third-party UIs that you can use for monitoring:

BullMQ

  • Taskforce

Bull v3

  • Taskforce
  • bull-board
  • bull-repl
  • bull-monitor
  • Monitoro

Bull <= v2

  • Matador
  • react-bull
  • Toureiro

Monitoring & Alerting

  • With Prometheus Bull Queue Exporter

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 ✓
Batches 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

Install

bash
npm install bull --save

or

bash
yarn add bull

Requirements: Bull requires a Redis version greater than or equal to 2.8.18.

Typescript Definitions

bash
npm install @types/bull --save-dev
bash
yarn add --dev @types/bull

Definitions are currently maintained in the DefinitelyTyped repo.

Contributing

We welcome all types of contributions, either code fixes, new features or doc improvements. Code formatting is enforced by prettier. For commits please follow conventional commits convention. All code must pass lint rules and test suites before it can be merged into develop.


Quick Guide

Basic Usage

…

Using promises

Alternatively, you can return promises instead of using the done callback:

…

Separate processes

The process function can also be run in a separate process. This has several advantages:

  • The process is sandboxed so if it crashes it does not affect the worker.
  • You can run blocking code without affecting the queue (jobs will not stall).
  • Much better utilization of multi-core CPUs.
  • Less connections to redis.

In order to use this feature just create a separate file with the processor:

javascript
// processor.js
module.exports = function (job) {
  // Do some heavy work

  return Promise.resolve(result);
}

And define the processor like this:

javascript
// Single process:
queue.process('/path/to/my/processor.js');

// You can use concurrency as well:
queue.process(5, '/path/to/my/processor.js');

// and named processors:
queue.process('my processor', 5, '/path/to/my/processor.js');

Repeated jobs

A job can be added to a queue and processed repeatedly according to a cron specification:

javascript
  paymentsQueue.process(function (job) {
    // Check payments
  });

  // Repeat payment job once every day at 3:15 (am)
  paymentsQueue.add(paymentsData, { repeat: { cron: '15 3 * * *' } });

As a tip, check your expressions here to verify they are correct: cron expression generator

Pause / Resume

A queue can be paused and resumed globally (pass true to pause processing for just this worker):

javascript
queue.pause().then(function () {
  // queue is paused now
});

queue.resume().then(function () {
  // queue is resumed now
})

Events

A queue emits some useful events, for example...

javascript
.on('completed', function (job, result) {
  // Job completed with output result!
})

For more information on events, including the full list of events that are fired, check out the Events reference

Queues performance

Queues are cheap, so if you need many of them just create new ones with different names:

javascript
const userJohn = new Queue('john');
const userLisa = new Queue('lisa');
.
.
.

However every queue instance will require new redis connections, check how to reuse connections or you can also use named processors to achieve a similar result.

Cluster support

NOTE: From version 3.2.0 and above it is recommended to use threaded processors instead.

Queues are robust and can be run in parallel in several threads or processes without any risk of hazards or queue corruption. Check this simple example using cluster to parallelize jobs across processes:

…

Documentation

For the full documentation, check out the reference and common patterns:

  • Guide — Your starting point for developing with Bull.
  • Reference — Reference document with all objects and methods available.
  • Patterns — a set of examples for common patterns.
  • License — the Bull license—it's MIT.

If you see anything that could use more docs, please submit a pull request!


Important Notes

The queue aims for an "at least once" working strategy. This means that in some situations, a job could be processed more than once. This mostly happens when a worker fails to keep a lock for a given job during the total duration of the processing.

When a worker is processing a job it will keep the job "locked" so other workers can't process it.

It's important to understand how locking works to prevent your jobs from losing their lock - becoming stalled - and being restarted as a result. Locking is implemented internally by creating a lock for lockDuration on interval lockRenewTime (which is usually half lockDuration). If lockDuration elapses before the lock can be renewed, the job will be considered stalled and is automatically restarted; it will be double processed. This can happen when:

  1. The Node process running your job processor unexpectedly terminates.
  2. Your job processor was too CPU-intensive and stalled the Node event loop, and as a result, Bull couldn't renew the job lock (see #488 for how we might better detect this). You can fix this by breaking your job processor into smaller parts so that no single part can block the Node event loop. Alternatively, you can pass a larger value for the lockDuration setting (with the tradeoff being that it will take longer to recognize a real stalled job).

As such, you should always listen for the stalled event and log this to your error monitoring system, as this means your jobs are likely getting double-processed.

As a safeguard so problematic jobs won't get restarted indefinitely (e.g. if the job processor always crashes its Node process), jobs will be recovered from a stalled state a maximum of maxStalledCount times (default: 1).

Issues· 148 open

View all issuesOpen on GitHub
  • #2819

    JOB STALL ISSUE IN QUEUE

    Updated Sep 17, 2026
  • #2821

    Update of `uuid` dependency because of vulnerability

    Updated Aug 10, 2026
  • #2005

    Redis Cluster, Can't add the job to the failed queue

    bugUpdated Jun 3, 2026
  • #758

    Error: Sending custom commands in pipeline is not supported in Cluster mode when use Cluster Mode

    enhancementPRIO 1Updated Jun 3, 2026
  • #1304

    Possible infinite loop if BRPOPLPUSH fails ?

    bugUpdated Jun 3, 2026
  • #1546

    Possible to push (unattempted) jobs back on a queue?

    enhancementUpdated Sep 18, 2024
  • #2030

    Removing repeatable jobs by data passed in queue.add

    enhancementUpdated Dec 2, 2023
  • #854

    Set the failed/completed jobs automatically removed after a period time

    enhancementUpdated Jun 29, 2023
  • #416

    -OOM command not allowed when used memory > 'maxmemory'.

    BETTER DOCUpdated Mar 29, 2023
  • #2151

    [Feature Request] Piping stdout from child process into main process

    enhancementUpdated Mar 4, 2023

> Tags

JavaScriptjobjob-queuemessagemessage-queue

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言