Skip to content

agmoyano/redis-event-queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redis-event-queue

Interprocess queue based on Redis that implements EventEmitter interface

Install

npm install --save redis-event-queue

Usage

Emmiter

var req = require('redis-event-queue')(options);

var wqueue = req.workqueue;
var bqueue = req.broadcast;

for(var i = 0; i < 10; i++) {
  wqueue.emit('event', 'work msg '+i);
  bqueue.emit('event', 'broad msg '+i);
}

Listener

var req = require('redis-event-queue')(options);

var wqueue = req.workqueue;
var bqueue = req.broadcast;

wqueue.on('event', function(msg) {
  console.log('work: '+msg);
});

bqueue.on('event', function(msg) {
  console.log('broad: '+msg);
});

options

  • prefix: Set keys prefix to use in redis.

All other options are the same as described in redis.

workqueue

Delivers a message to the first process available

broadcast

Delivers a message to all processes listening

#Next

Add optional pattern to listen to messages in workqueue an broadcast

#Suggestions

If you have any suggestions, comments or bug reports, please add an issue in github or PR directly!

Thanks.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published