0

I'm using RabbitMQ queue, I'm using it in node.js / express app, I'm using Wascally as my library to consume and publish messages.

My scenario is, that after consumer finalizes handling message it requeue's the message again, so the task is being done in a cycle. For example message initiates the task of downloading data from some API and after it's finished it publishes the same message again so the data download will be performed again.

The problem is that if my consumer app crashes the message stays in the queue as "Unacked". What should I do to get my message back to the queue if the consumer does not respond for some time (for example 30 seconds)?

Łukasz W.
  • 9,538
  • 5
  • 38
  • 63
  • Make sure that heartbeats are enabled. It's an mechanism for the server to recognize the client connection as down. – Carl Hörberg Apr 29 '15 at 11:59
  • what exactly app crash here, generally once the consumer is dead the message automatically comes to normal state from 'unacked' – prathap Apr 29 '15 at 14:40
  • @prathap when I run the consumer app again I do not get the message again. I'd like to get it again. – Łukasz W. Apr 29 '15 at 15:06
  • that means your first consumer program is still running and due to this your message is still in NACK state. If you run consumer again it will try to consume ACK messages and it never going to consume NACK messages. You have to exit your consumer on crash or whatever properly so that messages will come to ACK state from NACK – prathap Apr 29 '15 at 15:43
  • @prathap I'm positive that first consumer is down. I'm running it locally in node using npm start and then turning it off, going back to console so.. definitely it's turned off.. – Łukasz W. Apr 29 '15 at 15:56
  • can you open admin console in browser (localhost:15672) and see any consumers in the 'consumers' div by clicking on the queue. am sure there will be any consumer holding that NACK message. – prathap Apr 29 '15 at 17:55

0 Answers0