bull-queue-manager
Minimalist queue manager based on bull: the awesome Node.js job and message queue.
This module provides a high level API that allow you to re-use shared configurations and instances, as well as reduce the number of redis connections to the minimum by default. Also introduce a convenient "response" promise to easily process jobs result:
let result = await q1response;
Usage
Create and initialize Queue Manager:
const QueueManager = QueueManager;const qm = 6379 //redis port 'localhost' //redis host 0 //redis db {} //redis options (described in https://github.com/luin/ioredis/blob/master/API.md);qm;
// also redis connection URL can be usedconst qm = 'redis://localhost:6379/0' // options;
Create some queues on demand:
const q1 = qm;const q2 = qm;const q3 = qm;const q4 = qm; // optionally override default configconst q5 = qm;const q6 = qm;// ...
Register job processors:
q1;
Add jobs to queues:
let promise = q1;let job = await promise; // https://github.com/OptimalBits/bull#job
Add jobs to queues, optionally process result from processing:
let promise = q1;// you can get the response promise herelet result = await promiseresponse;// result == { success: true }
Shutdown the QueueManager instance (close all queues):
qm;