egg-delayed-queue
A priority queue queue backed by redis, built for eggjs.
Install
$ yarn add egg-delayed-queue
Usage
exports.queue = {
enable: true,
package: 'egg-delayed-queue',
};
Configuration
'use strict';
exports.queue = {
client: {
queuePrefix: 'q',
redis: {
port: 6379,
host: '127.0.0.1',
auth: '',
db: 3,
options: {
},
},
},
};
see config/config.default.js for more detail.
Example
app.queue.process('orderNo', (job, done) => {
const ctx = app.createAnonymousContext();
ctx.service.home.dealOrder(job.data, done);
});
app.queue.create('orderNo', {
orderNo: '1111111',
create_time: Date.now()
}).delay(milliseconds)
.save();
form more config please see here
Questions & Suggestions
Please open an issue here.
License
MIT