Pub Sub "infinnite loop"


We are using Nameko within AWS Elastic Beanstalk (EB) and we encountered following problem: One of our services uses Pub/Sub to pull the workload and during the execution of this workload service docker on the machine runs out of memory, crushed and EB restart nameko service and it is trying to process the same workload again and crushes and it continues forever. I was wondering if we can somehow limit the number of “retries” say worker only consumes message once or twice?


The AMQP spec has a provision in it for tracking the number of delivery attempts. Unfortunately it looks like it’s not yet implemented by RabbitMQ.

In the mean time the best you can do is track this in your application. For example you could subclass the event_handler entrypoint and make it ignore a message that it has seen multiple times before. You’ll have to use some heuristic to determine whether the message is a duplicate or not, such as a combination of the payload and the call_id_stack in the headers.