egg-delayed-job
v1.0.0
Published
A priority job queue backed by redis, built for eggjs.
Downloads
11
Maintainers
Readme
egg-delayed-job
A priority job queue backed by redis, built for eggjs.
Install
$ npm i egg-delayed-job --save
Usage
// {app_root}/config/plugin.js
exports.delayedJob = {
enable: true,
package: 'egg-delayed-job',
};
Configuration
// {app_root}/config/config.default.js
'use strict';
exports.delayedJob = {
client: {
queuePrefix: 'q',
redis: {
port: 6379,
host: '127.0.0.1',
auth: '',
db: 3,
// see https://github.com/mranney/node_redis#rediscreateclient
options: {
},
},
},
// clients: {}
};
see config/config.default.js for more detail.
Example
app.delayedJob.process('email', (job, done) => {
// send email for this;
email(job.data.to, done);
});
app.delayedJob.create('email', {
title: 'welcome email for justin'
, to: '[email protected]'
, template: 'welcome-email'
}).save();
form more config please see here
Questions & Suggestions
Please open an issue here.