How to safely replay dead-lettered messages in RabbitMQ without causing new incidents
When a bug that caused message failures is fixed, engineers often need to replay hundreds of dead-lettered messages back to their original queues in RabbitMQ. RabbitMQ dead-letters messages under conditions such as consumer rejection, TTL expiry, queue length limits, or delivery limit breaches, attaching an x-death header that records the message's origin and failure reason. Before replaying, teams should confirm the root cause is resolved, identify the correct destination, and filter out any poison messages still in the dead-letter queue. Options for replaying include the management UI's Move Messages panel, a dynamic shovel via rabbitmqctl, or a custom script using a client library like Python's pika. Each approach has trade-offs around selectivity, x-death header cleanup, delivery confirmations, and auditability that determine whether the replay succeeds or triggers a second incident.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in