I have a RabbitMQ Server set up where I fetch messages using Python-Pika. The problem is that if I have persistent delivery mode enabled, and the workers fails to process a message. Instead of releasing the message, it will keep it until the message until the RabbitMQ connection has been reset.
Is there a way to make sure that the message that failed to process automatically gets picked up again within a reasonable time-frame from an available worker, including the same one?
This is my current code
if success:
ch.basic_ack(delivery_tag=method.delivery_tag)
else:
syslog.syslog('Error (Callback) -- Failed to process payload: %s' % body)
The idea is that I never want to lose a message, instead I want it to get re-published, or rather picked up again if it failed. This should always be the case until the message has been successfully processed by a worker. This normally happens when one of the worker is unable to open a connection to the HTTP server.