Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    redis-jobspublic

    redis-jobs

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

    BuildStatus

    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.

    Keywords

    none

    install

    npm i redis-jobs

    Downloadsweekly downloads

    7

    version

    0.0.1

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar