Burstable
Simple and powerful task queue for Node.js on top of Beanstalkd
Features
- Wait for job completion
- Child jobs (keeping parent alive till done)
How-To
Setup
import Burstable from 'burstable';
const burstable = new Burstable(
host,
port,
{
log: function(level, err|message, meta) {
winston.log(level, message.message || message, meta);
}
}
);
Spawning jobs
burstable.spawn(tube, {
delay: 0,
priority: 1000,
timeout: 10 * 60 * 1000,
payload: {
},
wait: Job | [Job...] | [{tube: String, id: Number}]
});
Handling jobs
burstable.handle(tube, function (payload) {
return Promise.resolve();
return Promise.reject();
return this.child(anotherTube);
this.log('info', 'doing the thing');
}, {
maxTries: 3,
backoff: {
initial: 60 * 1000,
exponential: 1.5
},
log: function(level, err|message, meta) {
winston.log(level, message.message || message, meta);
}
});
burstable.start();
Debugging
Use DEBUG=burstable*
to enable verbose debugging.