Debugging RabbitMQ's messages

Sometimes, it is useful to just have an idea of the messages that are really traveling through a broker by just logging all of them to the standard output.

It is possible to trace those messages using a simple application provided with the RabbitMQ Java client.

Getting ready

To run this recipe, you need to have RabbitMQ up and running on the standard port 5672 and the RabbitMQ Java client library.

How to do it...

RabbitMQ includes a tracing utility in the Java client library that you can put in action by following these steps.

  1. Download the latest version of the RabbitMQ Java client library from http://www.rabbitmq.com/java-client.html.
  2. Unpack it and enter its directory.
  3. Run the Java tracer by running:
    ./runjava.sh com.rabbitmq.tools.Tracer ...

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.