In this example we are showing how to create a dynamic load balancer, and how to distribute messages to many consumers. We are going to create a file downloader.
You can find the source at
To use this recipe we need to set up the Java development environment as indicated in the Introduction section.
In order to let two or more RabbitMQ clients properly balance consuming messages, you need to follow the given steps:
channel.queueDeclare(myQueue, false, false, false,null); channel.basicQos(1);
channel.basicConsume(myQueue, false, consumer);