BullMQ
Search…
Getters
When jobs are added to a queue, they will be in different statuses during their lifetime. BullMQ provides methods to retrieve information and jobs from the different statuses.
Lifecycle of a job

Job Counts

It is often necessary to know how many jobs are in a given status:
1
import { Queue } from 'bullmq';
2
3
const myQueue = new Queue('Paint');
4
5
const counts = await myQueue.getJobCounts('wait', 'completed', 'failed');
6
7
// Returns an object like this { wait: number, completed: number, failed: number }
Copied!
The available status are: completed, failed, delayed, active, wait, paused and repeat.

Get Jobs

It is also possible to retrieve the jobs with pagination style semantics. For example:
1
const completed = await myQueue.getJobs(['completed'], 0, 100, true);
2
3
// returns the oldest 100 jobs
Copied!
Copy link
Contents