htpbean
v1.0.2
Published
Beanstalkd watcher and emmiter based on fivebeans. It provides additional debug messages
Downloads
3
Readme
Beanstalkd watcher and emmiter based on fivebeans. It provides additional debug messages
Use
Example for email queue handle
var Watcher = require('htpbean').watcher
var Emitter = require('htpbean').emmiter
var emailResponder = new Emitter({
id: 'mailResponder',
host: 'localhost',
port: 11200,
tube: 'email-send-response'
});
var emailWorker = new Watcher({
id: 'emailWorker',
host: 'localhost',
port: 11200,
tube: 'email-send',
handler: function handler(job) {
var self = this;
return Promise.resolve(job)
.then(dataFilterFunction.bind(self))
.then(doWorkFunction.bind(self))
.then(buildResponseFunction.bind(self))
.then(function(responsePayload){
emailResponder.put(responsePayload);
})
// if no catch block throw Error auto call bury job.
// if no Error - auto call destroy job
}
});
emailWorker.start();