BullMQ - Message Queue and Batch processing for NodeJS, Python, .NET, Elixir, Rust and PHP based on Redis or PostgreSQL
BullMQ - Message Queue and Batch processing for NodeJS, Python, .NET, Elixir, Rust and PHP based on Redis or PostgreSQL
You can find tutorials and news in this blog: https://blog.taskforce.sh/
BullMQ is available natively in multiple languages:
npm install bullmq)python/ directory (pip install bullmq)rust/ directory (cargo add bullmq-official --rename bullmq)elixir/ directory ({:bullmq, "~> x.x"})dotnet/ directory (dotnet add package BullMQ)php/ directoryFor other platforms, check out the BullMQ Proxy.
Supercharge your queues with a professional front end:
Sign up at Taskforce.sh
Some notable organizations using BullMQ:
Install:
$ yarn add bullmqIf you use the node-redis adapter (createNodeRedisClient), install redis v5 or newer (redis >= 5.0.0).
If you use the Valkey Glide adapter (createValkeyGlideClient), install @valkey/valkey-glide.
Add jobs to the queue:
import { Queue } from 'bullmq';
const queue = new Queue('Paint');
queue.add('cars', { color: 'blue' });Process the jobs in your workers:
import { Worker } from 'bullmq';
const worker = new Worker('Paint', async job => {
if (job.name === 'cars') {
await paintCar(job.data.color);
}
});Listen to jobs for completion:
import { QueueEvents } from 'bullmq';
const queueEvents = new QueueEvents('Paint');
queueEvents.on('completed', ({ jobId }) => {
console.log('done painting');
});
queueEvents.on(
'failed',
({ jobId, failedReason }: { jobId: string; failedReason: string }) => {
console.error('error painting', failedReason);
},
);Adds jobs with parent-child relationship:
…This is just scratching the surface, check all the features and more in the official documentation
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 | ✓ | ✓ | ||||
| Deduplication (Debouncing) | ✓ | ✓ | ✓ | |||
| Deduplication (Throttling) | ✓ | ✓ | ✓ | |||
| 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 |
Fork the repo, make some changes, submit a pull-request! Here is the contributing doc that has more details.
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.
Dependency Dashboard
[Feature]: Add getJob method to Queue in Python SDK
PostgreSQL backend reads SQL from disk at runtime, breaking every single-file bundler
[Bug]: ioredis v6 `RedisOptions` not assignable to bullmq v6 `ConnectionOptions`
[Bug]: getJobs Lua script (since 5.81.1) blocks Redis for seconds on unbounded ranges default 0-1 turned getDelayed() into a stop-the-world call
[Bug]: SSL Cert https://api.docs.bullmq.io/
[Feature request] search a specific job
[Bug]: Python QueueEvents broken on Postgres
PostgreSQL - Type string is not assignable to type ConnectionOptions
[Bug]: Rust Worker never recovers from a dropped Redis connection