-
Book Overview & Buying
-
Table Of Contents
RabbitMQ Cookbook
By :
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.
You need Java 1.7 or higher and Apache maven.
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:
Create a maven project and add RabbitMQ client dependency.
Create a producer class that extends ReliableClient.
Create a consumer class that extends ReliableClient.
For both consumer and producer classes create an ExecutorService Java class using the following method:
ExecutorServiceexService = Executors.newFixedThreadPool(threadNumber);
Create as...
Change the font size
Change margin width
Change background colour