Using RabbitMQ to troubleshoot itself

As mentioned in the previous recipe, we can monitor the RabbitMQ behavior by accessing its log files in quite a conventional way.

It is also possible to access the same kind of information using RabbitMQ itself, by informing a generic AMQP client of the broker activity.

Getting ready

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

How to do it...

To consume log messages, you can execute the Java main function in Consumer.java. You can find this in the book source archive in the directory Chapter12/Recipe02/Java/src/rmqexample. In the following, we highlight the main steps:

  1. Create a temporary-anonymous queue and bind it to the AMQP log exchange:
    String tmpQueue = channel.queueDeclare().getQueue(); ...

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.