How to know where a message is in RabbitMQ

Issue

I am writing a service using Go and using RabbitMQ for messaging. I need to add information in the header that should contain where the message flows through, it should add the exchange name or the queue name in the message header as and when it enters one.

Can someone tell me how this can be done?

Solution

Every delivered message has a set of properties. Two of these are the exchange used to route the message, and the routing key. Depending on the type of exchange you can also figure out the queue name based on this information.

https://www.rabbitmq.com/amqp-0-9-1-quickref.html

If you need to know when a message is published you can use this plugin – https://github.com/rabbitmq/rabbitmq-message-timestamp


NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

Answered By – Luke Bakken

Answer Checked By – Timothy Miller (GoLangFix Admin)

Leave a Reply

Your email address will not be published.