Overview
When jobs are added to a queue, they transition through different states during their lifecycle. BullMQ provides methods to retrieve information and jobs from these various states.
Job Counts
Get the number of jobs in specific statuses:Available Job States
From the Job class documentation:completed- Jobs that have finished successfullyfailed- Jobs that have failed after all retry attemptsdelayed- Jobs waiting for their delay time to expireactive- Jobs currently being processedwait- Jobs waiting to be processedwaiting-children- Jobs waiting for child jobs to completeprioritized- Jobs with priority > 0 waiting to be processedpaused- Jobs in a paused queuerepeat- Repeatable job configurations
Get Jobs
Retrieve jobs with pagination:types- Array of job states to retrievestart- Starting index (0-based)end- Ending indexasc- Iftrue, returns oldest first; iffalse, returns newest first
Get Jobs by State
BullMQ provides convenience methods for specific states:Job State Checks
Fromsrc/classes/job.ts:971-1008:
Get Current State
Fromsrc/classes/job.ts:1030:
Get Job by ID
Retrieve a specific job by its ID:src/classes/job.ts:470:
Get Counts per Priority
For prioritized jobs, get counts for specific priority levels:Pagination Example
Retrieve all jobs in batches:Common Patterns
Monitor Queue Health
Monitor Queue Health
Track queue statistics:
Find Failed Jobs
Find Failed Jobs
Retrieve and analyze failed jobs:
Check Job Status
Check Job Status
Track a specific job’s progress:
Read More
Get Job Counts
getJobCounts API Reference
Get Jobs
getJobs API Reference
Job State
getState API Reference
From ID
Job.fromId API Reference
