jsredismq
v1.0.3
Published
A reliable message queue client based on redis streams.
Downloads
3
Maintainers
Readme
jsredismq
RedisMQ uses the redis stream data structure to effect a message queue. The stream key name is the id of the message queue.
It provides support for confirmed and unconfirmed guaranteed message queuing. Guaranteed messages will remain in the queue (as unread or pending messages in the redis stream) until they are read and acknowledged by exactly one consumer. Confirmed producers will get a response only when the message is received and processed by a consumer. Unconfirmed (but guaranteed) still means only a single consumer will process the message, but no response is sent.
RedisMQ libraries for Python and Javascript are available.
Install
$ npm install jsredismq
Basic Usage
const RedisMQ = require("redismq");
const mq = new RedisMQ({
port: 6379,
host: "127.0.0.1",
password: "secret",
db: 123,
});
const producer = mq.producer('mystream');
producer.addConfirmedMessage('Hello there! Let me know when you get this.')
.then(response => console.log('Got confirmation', response));
const consumer = mq.consumer('mystream', 'mygroup', 'consumer1')
consumer.readOne()
.then(payload => {
console.log('Got message', payload.message);
payload.ack(payload.responseChannel ? 'Message received and acked' : '')
.then(() => console.log('message acked'));
});