@giuem/egg-kue
v0.2.2
Published
[![NPM version][npm-image]][npm-url]
Downloads
3
Readme
egg-kue
A priority job queue backed by redis, built for eggjs.
Install
$ npm i @giuem/egg-kue --save
For egg 1.x, use egg-kue instead.
Usage
// {app_root}/config/plugin.js
exports.kue = {
enable: true,
package: '@giuem/egg-kue',
};
Configuration
// {app_root}/config/config.default.js
'use strict';
exports.kue = {
app : true,
agent : false,
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.kue.process('email', (job, done) => {
// send email for this;
email(job.data.to, done);
});
app.kue.create('email', {
title: 'welcome email for justin'
, to: '[email protected]'
, template: 'welcome-email'
}).save();