RabbitMQ dead letter exchange - route by "x-death.reason" or "x-first-death-reason" header
Asked Answered
L

2

6

I am trying to set up RabbitMQ to route messages through a Dead Letter Exchange based on the death reason (either "x-death.reason" or "x-first-death-reason" would do).

My understanding is that when a message dies that "x-death.reason" and "x-first-death-reason" are set as headers when the messages is sent to the DLX. So my reasoning is that I should be able to set up an exchange with type=headers to be able to route by the value of these headers.

Unfortunately, I just can't get it to work.

The DLX is set up like

dead letter queue setup

However each dead message gets routed to all of the bound queues.

target queues

i.e. the filtering/routing is not working.

Can someone please let me know how to configure this correctly.

Thanks

Luxuriant answered 12/10, 2020 at 4:41 Comment(0)
E
3

From: https://www.rabbitmq.com/tutorials/amqp-concepts.html#exchange-headers

Note that headers beginning with the string x- will not be used to evaluate matches.

Enscroll answered 6/5, 2021 at 8:37 Comment(0)
D
1

From same documentation as @abaelter wrote about exchange-headers, but updated:

For any and all, headers beginning with the string x- will not be used to evaluate matches. Setting x-match to any-with-x or all-with-x will also use headers beginning with the string x- to evaluate matches.

Now you can use x-match with value any-with-x and headers with x- shoud start works.

Something like this:

rabbitmq dlx.text exchange setup

Datura answered 12/12, 2022 at 7:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.