From 2ce183392df387c57b26f49a03485039a7be8f29 Mon Sep 17 00:00:00 2001 From: Lewis Renfrew Date: Tue, 25 Aug 2026 11:28:32 +0100 Subject: [PATCH] remove x-dead-letter-routing-key to preserve original routing key on dead letter --- changelog.md | 5 +++++ src/Linn.Common.Messaging.RabbitMQ.csproj | 2 +- src/RabbitChannelConfiguration.cs | 3 +-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 1c88dd1..5d598f1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog +## [6.0.1] - 2026-08-25 +### *Bug Fix* +- Remove `x-dead-letter-routing-key` from main queue arguments. Previously set to `""`, this caused RabbitMQ to overwrite the original routing key on dead-letter, making messages unroutable when requeued from the DLQ back to the original exchange. The original routing key is now preserved automatically. +- **Deployment note:** Any existing `.q` queue declared with this library must be deleted and recreated for this change to take effect. RabbitMQ will throw 406 PRECONDITION_FAILED if the queue already exists with the old arguments. + ## [6.0.0] - 2026-05-28 ### *Changes (Breaking)* - RabbitMessageRouter now takes `IServiceProvider` instead of `IEnumerable` and creates a DI scope per received message. This ensures scoped services (e.g. DbContext) are fresh for each message, preventing stale tracked entities from leaking across messages. diff --git a/src/Linn.Common.Messaging.RabbitMQ.csproj b/src/Linn.Common.Messaging.RabbitMQ.csproj index 5f13cc7..7b651a4 100644 --- a/src/Linn.Common.Messaging.RabbitMQ.csproj +++ b/src/Linn.Common.Messaging.RabbitMQ.csproj @@ -5,7 +5,7 @@ enable Linn.Common.Messaging.RabbitMQ Linn.Common.Messaging.RabbitMQ - 6.0.0 + 6.0.1 enable diff --git a/src/RabbitChannelConfiguration.cs b/src/RabbitChannelConfiguration.cs index 30e961a..c032aaf 100644 --- a/src/RabbitChannelConfiguration.cs +++ b/src/RabbitChannelConfiguration.cs @@ -91,8 +91,7 @@ await setupChannel.QueueBindAsync( var args = new Dictionary { - { "x-dead-letter-exchange", $"{this.dlxName}.dlx" }, - { "x-dead-letter-routing-key", string.Empty } + { "x-dead-letter-exchange", $"{this.dlxName}.dlx" } }; await setupChannel.QueueDeclareAsync(