Dead Letter Queue

66 Views Asked by At

I have an exchange Seals(topic) and a SealsAndActs queue and there was a need to make a dlq. Moreover, it should be Retry every day, but at the same time I don’t want to use Delay for Exchange and I want the dlq to have a message ttl that will be sent back to exchange Seals so the message will fly back to the SealsAndActs queue.

To begin with, I want to clarify that I use 1 queue for all operations on this message, and I carry the operation itself in routingKey. (I’ve been studying RabbitMQ for a while now and don’t know if this is a normal scenario or if it’s better to use 1 queue for 1 operation, if you can, then write is it ok?)

Seals(topic) (SealsAndActs.Add, SealsAndActs.Update, SealsAndActs.Delete, SealsAndActs.*) -> SealsAndActs

So, I connected my SealsAndActs queue to dlx:

x-dead-letter-exchange: Seals.dlx
x-dead-letter-routing-key:  SealsAndActs.Retry

Created Seals.dlx and SealsAndActs.dlq and registered for it

x-dead-letter-exchange: Seals
x-dead-letter-routing-key: SealsAndActs.Retry
x-message-ttl: 15000

But the problem is that I lose my original rk which carries information about the operation: enter image description here

Tell me how to solve my problem, maybe x-dead-letter-routing-key: SealsAndActs.Retry can be replaced with my original rk? Or maybe use another method. If it’s not difficult, tell me maybe there is some kind of pattern or guide.

Delay Exchange is not suitable for me, because... it collects objects from the queue. And I would like to know if I have objects in dlq. Or is it easier for me to get the original rk from the consumer service?

0

There are 0 best solutions below