Selective RabbitMQ dead-letter replay: move only matching messages with a Python script
Replaying an entire RabbitMQ dead-letter queue resends messages that should not be retried, such as orders and declined payments. Basic get-and-requeue loops fail because requeued messages return to the head of the queue. The article's approach keeps unwanted messages unacknowledged while reading onward, then returns them all with a single negative acknowledgement. Matching messages are republished with publisher confirms and mandatory routing before the original is acked, and dead-letter headers are stripped. Tests on classic and quorum queues reportedly preserved the order of the messages left behind and kept nothing moved if a failure occurred.
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