Redisq is a redis backed queue, message broker for node js
- Installation :
npm i https://github.com/kartik1998/redisq.git#v0.0.0
To send a message: (send.js)
const RedisQ = require('redisq');
const redisq = new RedisQ();
redisq.sendToQueue('world', 'my first message', (err, data) => {
console.log(data);
process.exit();
});
Sample output : OK
To recieve message: (recieve.js)
const RedisQ = require('redisq');
const redisq = new RedisQ();
redisq.consume('world', (channel, message) => {
console.log('queueName ->', channel);
console.log('message ->', message);
});
Sample output:
queueName -> world
message -> my first message
Please note that the messages that aren't consumed are persisted in redis and are consumed later on by a queue consumer.
Redisq by default connects to 127.0.0.1:6379.
You can use your own specific options by using something like const redisq = new RedisQ({options}). refer: https://www.npmjs.com/package/redis