BullMQ is a powerful queue system for handling jobs in Node.js, and installing it into your project is straightforward using npm or yarn.
Firstly, you need to make sure that Redis is installed on your machine as BullMQ depends on it. Redis can be installed following the instructions on their official website: https://redis.io/topics/quickstart
After ensuring the availability of Redis, you can install BullMQ by running the following command in your terminal:
If you're using npm:
npm install bullmq
Or if you're using yarn:
yarn add bullmq
This will add BullMQ to your node_modules
directory, and it can then be imported and used within your project like so:
const { Queue } = require('bullmq'); const queue = new Queue('my-queue'); // Adding a job to the queue queue.add('my-job', { some: 'data' });
Please note that you should have a redis instance running before you try to create a new Queue.
Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.