1

I have a requirement that if my consumer read the messages from the queue and could not acknowledge some messages due to some issue. Then I want after a certain time lets say in every 30 seconds it should acknowledge pending messages. Can we do it?

Edit: I have found channel.recover the function which will ask rabbitmq to unacknowledged message. But we have to call this message explicitly. is there a way by rabbit-mq can deliver unacknowledged messages after every certain seconds.

TechChain
  • 8,404
  • 29
  • 103
  • 228
  • You can send the message to another queue, e.g. 'pending'. Add to the message a timestamp and destination queue, then create a consumer to read from this queue, if the timestamp is reached, then forward the message to the destination queue to be processed. – Eamonn McEvoy Nov 29 '19 at 07:59
  • How this timestamp and destination queue thing will work? I am not getting it – TechChain Nov 29 '19 at 08:01
  • If a message fails processing, send it to the pending queue e.g. `{ ttl: "${now + 30sec }", destination: ${name_of_original_queue}, payload: ${ serialized_message_payload }`. Then, a pending consumer will continuously read form this queue and check if the ttl has passed, if so, it will push the message payload toward the destination queue, otherwise, put it to the back of the pending queue. – Eamonn McEvoy Nov 29 '19 at 13:05

0 Answers0