Tracing RabbitMQ's ongoing activity

Sometimes, we need to trace all the messages that are being received and delivered by RabbitMQ, to analyze and debug unexpected application behavior.

RabbitMQ provides the so-called firehose tracing tool to have such information available.

The tracing activity can be enabled and disabled at runtime, and it should be used just for debugging since it imposes an overhead on the broker activity.

Getting ready

To run this recipe, we need RabbitMQ up and running and the Java client library.

How to do it...

RabbitMQ sends trace messages using the same mechanism used for log messages; so, the example code is very similar to the one of the previous recipe.

To consume trace messages, you can execute the Java main function

Get RabbitMQ Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.