You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lightweight, reliable background job queue for Node.js
QueueBolt is a simple, production-ready background job queue for Node.js. It handles retries with exponential backoff, job priorities, delayed execution, dead-letter queues, and pluggable storage backends — without the complexity of heavy message brokers.
Why QueueBolt?
Most job queues are either too simple (no retries, no persistence) or too complex (require dedicated infrastructure, steep learning curve). QueueBolt sits in the sweet spot:
import{Queue}from"queuebolt";// Create a queueconstqueue=newQueue("emails");// Register a processorqueue.process(async(job)=>{console.log(`Sending email to ${job.data.to}`);awaitsendEmail(job.data.to,job.data.subject);return{sent: true};});// Add a jobawaitqueue.add("welcome-email",{to: "user@example.com",subject: "Welcome!",});
With Retries and Priority
awaitqueue.add("critical-notification",{to: "admin@example.com",subject: "Server Alert",},{priority: -10,// CRITICAL — processed firstattempts: 5,// Retry up to 5 timesbackoff: {type: "exponential",delay: 1000,// 1s, 2s, 4s, 8s, 16smaxDelay: 30000,// Cap at 30s},timeout: 10000,// Fail if takes > 10sdeadLetter: true,// Move to DLQ after all retries});
queue.on("job:completed",(job)=>{console.log(`✓ ${job.name} completed:`,job.result);});queue.on("job:failed",(job,error)=>{console.log(`✗ ${job.name} failed:`,error.message);});queue.on("job:retrying",(job,attempt)=>{console.log(`↻ ${job.name} retrying (${attempt}/${job.maxAttempts})`);});queue.on("job:dead",(job)=>{console.log(`☠ ${job.name} moved to dead-letter queue`);});queue.on("queue:drained",()=>{console.log("All jobs processed!");});