Improving bandwidth

Using noAck flag and managing the prefetch parameter is another client-side way to improve the performance and the bandwidth. Both noAck and prefetch are used by the consumers.

In this example, we are going to create one producer and one consumer using these parameters. You can find the source code at Chapter08/Recipe03.

Getting ready

You need Java 1.7 or higher and Apache maven.

How to do it…

We skip the producer code because it's the same one shown in the Multithreading and queues recipe. We still use the ReliableClient class as the base class. Let's see the consumer by performing the following steps:

  1. Create a maven project and add the RabbitMQ client dependency.
  2. Create a consumer main class, which reads from args[] to manage the ...

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.