Search code examples
node.jsqueuemessage-queuebeanstalkd

Best practice beanstalkd (queue) and node.js


I currently do service using beanstalkd and node.js. I would like when jobs fail, retry n time before give up the job. If the job succede i want do it the same job 10 time. So, what is the best practice, stock in mongo db with the jobId the error and success count, or delete and put a new job with a an error and success count in the body.

I dont know if i'm clear? so tell me , thanks a lot


Solution

  • You have a couple of ways to do this:

    • you can release the job, and obtain from stats the number of reserves
    • you can put a new job with a retry count, and keep track of history in the data payload

    You should do the later, and you don't need MongoDB as a second dependency.