Nodejs Kue Job Processing Logic

I have a very simple logical question.

I will run the work processing logic on a separate application server.

The order processing application will be a standalone application, doing nothing, just processing tasks.

In my code, how can I make sure my application constantly keeps checking the redis server for work? -I have to run the code in an infinite loop? -or I need to restart my application

or is there some kind of built-in mechanism in Kue that I'm missing here?

thanks

+5
source share
1 answer

See documentation - https://github.com/Automattic/kue#processing-jobs

As long as there is a queue, it will constantly run and perform tasks.

According to an 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(); } 
+3
source

All Articles