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

Multithreading and queues

Using threads can help the application's performance. In this recipe, we will show how to use connections, channels, and threads. In this example, we use Java, but generally, using threads is a good practice to improve the performance in most of the current technologies.

You can find the source code in the book archive under the path: Chapter08/Recipe01.

Getting ready

You need Java 1.7 or higher and Apache maven.

How to do it…

In this example, we have extended the ReliableClient Java class (refer to Chapter 7, Developing High-availability Applications) to create a producer and a consumer. Let's see the following steps in detail:

  1. Create a maven project and add RabbitMQ client dependency.
  2. Create a producer class that extends ...

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