Skip to content

creates jobs and puts it on a reliable redis queue for workers

Notifications You must be signed in to change notification settings

bryanpaluch/redis-jobs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redis-jobs

creates jobs and puts it on a reliable redis queue for workers

Build Status

Basic Usage

npm install redis-jobs

var redisjobs = require('redis-jobs');
var queue = new redisjobs.Queue();

var job = queue.createJob({foo: 'bar'});

job.on('timeout', function(){
  console.log('request timed out on message bus');
});

job.on('reply', function(res){
 console.log(res);
});

job.start();



//On worker drone

var worker = new redisjobs.Worker();

worker.on('job', function(job){
  var res = job.data.foo + 'baz';
  job.reply(res);
});

worker.listen();

Jobs are put onto a Redis List and popped off the list using BRPOPLPUSH; When a worker uses reply the message is deleted from the temporary work queue and sent over a publish message to the job requester. This allows jobs to queue up but the responses will be streamed back immediatly. Later releases will include a queue monitor interface to handle automatic load scaling.

About

creates jobs and puts it on a reliable redis queue for workers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published