RabbitMQ & AMQP (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)
Handling Poison Pill Messages: Max deliver count in Quorum Queues (`x-delivery-limit`) to prevent infinite crash loops.
senior LevelSystem DesignRabbitMQData Structures
In Simple Words: A "Poison Pill" is a malformed message that triggers an unhandled exception or segment fault in the consumer:
- Consumer crashes or nacks with
requeue: true. - Broker immediately redelivers the message to another consumer.
- Second consumer crashes. The poison pill loops infinitely, crashing the entire worker pool!
- Quorum Queue Solution: Set
"x-delivery-limit": 5. RabbitMQ tracks delivery count in metadata. After 5 failed attempts, the broker automatically drops or dead-letters the message to quarantine.