Parse RabbitMQ messages
Published in
1 min readMar 21, 2023
Sometimes, you have lots of messages in the RabbitMQ dead-letter queue and you want to analyze such messages.
Usually, you go to the RabbitMQ admin, get all messages and copy and paste and start analyzing…
But it is a daunting task, isn’t it?!
What if you have a Python library that reads a such big file full of messages and parses it for you?
Meet rmq-msg-parser, it works simply by reading the file and providing a list of Message objects that contains the message id, payload, headers and other attributes as well.
Example usage:
from rmqparser import messages
msgs = messages.get_messages(r'data/my_rabbitmq_messages.txt')
for m in msgs:
print(m.id, m.payload, m.headers, m.headers['__Exception_Message__'])
Here’s the Library on Github: