maki-queue
v0.0.2
Published
implements a queue service for maki
Downloads
5
Readme
Maki: Queue
A generic Worker Queue implementation, designed for Maki.
Quick Start
Implementing Maki's Queue is easy:
npm install maki-queue
- Queue jobs from your application:
var Queue = require('maki-queue');
var queue = new Queue('myAppName');
queue.enqueue('job-type', {
// job data
foo: 'bar'
}, function(err) {
// handle errors
});
- Process jobs from a worker (
worker.js
):
var Queue = require('maki-queue');
var queue = new Queue('myAppName');
// create the worker
var worker = new queue.Worker('myAppName');
// register job handlers
worker.register({
'job-type': function( data , jobIsDone ) {
// do work (in this test case, just log it out)
console.log( data );
// mark job as complete
jobIsDone();
}
});
// start the worker
worker.start();