Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

bullmq

Package Overview
Dependencies
Maintainers
1
Versions
555
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bullmq

Queue for messages and jobs based on Redis

  • 5.30.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
861K
increased by8.58%
Maintainers
1
Weekly downloads
Β 
Created

What is bullmq?

BullMQ is a powerful, fast, and feature-rich library for handling distributed job queues in Node.js. It is built on top of Redis and provides a robust set of features for managing background jobs, scheduling tasks, and handling concurrency.

What are bullmq's main functionalities?

Job Queue Management

BullMQ allows you to create and manage job queues. You can add jobs to a queue and process them using workers. This is useful for offloading tasks that can be processed asynchronously.

const { Queue, Worker } = require('bullmq');
const myQueue = new Queue('my-queue');

// Adding a job to the queue
myQueue.add('my-job', { foo: 'bar' });

// Processing jobs from the queue
const worker = new Worker('my-queue', async job => {
  console.log(job.name); // 'my-job'
  console.log(job.data); // { foo: 'bar' }
});

Job Scheduling

BullMQ supports job scheduling, allowing you to delay the execution of jobs. This is useful for tasks that need to be executed at a later time.

const { Queue } = require('bullmq');
const myQueue = new Queue('my-queue');

// Scheduling a job to run in 5 seconds
myQueue.add('my-delayed-job', { foo: 'bar' }, { delay: 5000 });

Concurrency Control

BullMQ allows you to control the concurrency of job processing. You can specify the number of jobs that can be processed simultaneously by a worker.

const { Worker } = require('bullmq');

// Creating a worker with concurrency of 5
const worker = new Worker('my-queue', async job => {
  console.log(job.name);
}, { concurrency: 5 });

Job Retries

BullMQ provides options for retrying failed jobs. You can specify the number of retry attempts and the backoff time between retries.

const { Queue } = require('bullmq');
const myQueue = new Queue('my-queue');

// Adding a job with retry options
myQueue.add('my-retry-job', { foo: 'bar' }, { attempts: 3, backoff: 5000 });

Other packages similar to bullmq

Keywords

FAQs

Package last updated on 29 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc