Prerequisites
Make sure you have:- Installed BullMQ (see Installation)
- Redis running locally or accessible remotely
Basic Example
Let’s build a simple job queue system. We’ll create a queue that processes “paint” jobs.Configuration Options
Both Queue and Worker accept connection options:Listening to Job Events
BullMQ provides two ways to listen to job events:1. Worker Events (Local)
Events emitted by the worker instance itself:2. QueueEvents (Global)
Global events that can be listened to from anywhere:The difference is that Worker events only fire for jobs processed by that specific worker, while QueueEvents fire for all jobs in the queue regardless of which worker processed them.
Adding Job Options
Jobs can be customized with various options:Reporting Progress
Workers can report progress during job processing:Complete Working Example
Here’s a complete example in a single file:example.ts
Error Handling
Always add error handlers to prevent crashes:TypeScript Support
BullMQ has full TypeScript support with generics:Next Steps
Now that you have a working queue, explore more features:Architecture
Learn how BullMQ works internally
Job Options
Explore delayed jobs, priorities, and more
Worker Concurrency
Process multiple jobs simultaneously
Job Flows
Create complex job dependencies
