I have a very simple logical question.
I will be running job processing logic on a separate app server.
My job processing app will be a standalone app, doing nothing just processing jobs.
In my code, how do I make sure that my app continuously keep checking redis server for jobs ? -Do I need to run the code in infinite loop ? -or Do I need to keep restarting my app
or there is some inbuilt mechanism in Kue that I'm missing here ?
Thanks
See the documentation - https://github.com/Automattic/kue#processing-jobs
While there is a queue, it will continually run, and pick off jobs.
As per the example:
var kue = require('kue')
, queue = kue.createQueue();
queue.process('email', function(job, done){
email(job.data.to, done);
});
function email(address, done) {
if(!isValidEmail(address)) {
//done('invalid to address') is possible but discouraged
return done(new Error('invalid to address'));
}
// email send stuff...
done();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With