Oraq
Description
Oraq (Ordered redis asynchronous queue) is a cross process, cross server, fast, reliable and lightweight redis-based async queue for Node.
Features
- super fast
- cross process
- easy to use
Compatibility
Supports node.js >= 7.6.0.
Installation
npm install --save oraq
Usage
const Oraq = require('oraq');
const oraq = new Oraq({
id: 'myQueue',
concurrency: 1
});
const job = ms => new Promise(resolve => setTimeout(() => resolve(ms), ms));
Promise.all([
14000,
8000,
10000,
7000
].map(delay => oraq.limit(job, {jobData: delay})))
.then(jobResults => console.log(jobResults));
Constructor options
const oraq = new Oraq({
id,
prefix,
connection,
ping,
timeout,
concurrency
});
API
const oraq = new Oraq();
oraq.limit(
job,
jobOptions = {
jobId,
jobData,
lifo
}
).then(jobResult => console.log(jobResult));
oraq.quit()
.then(() => console.log('Redis connection is closed'));
oraq.removeJobById('jobId')
.then(() => console.log('Job is removed'));
Tests
npm test
License
MIT © Yevhen Samoilenko