O'Reilly logo

RabbitMQ Cookbook by Sigismondo Boschi, Gabriele Santomaggio

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required