mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
506 B
19 lines
506 B
const RedisSMQ = require('rsmq')
|
|
, { redisClient } = require(__dirname+'/redis.js')
|
|
, rsmq = new RedisSMQ({ ns: 'rsmq', client: redisClient })
|
|
, queuename = 'generate'
|
|
|
|
rsmq.createQueue({ qname: queuename }, (err) => {
|
|
if (err && err.name !== 'queueExists') {
|
|
return console.error(err);
|
|
}
|
|
});
|
|
|
|
module.exports.push = (data) => {
|
|
rsmq.sendMessage({ qname: queuename, message: JSON.stringify(data) }, (err) => {
|
|
if (err) {
|
|
return console.error(err);
|
|
}
|
|
//message enqueued successfully
|
|
});
|
|
}
|
|
|