Lab - Receiver Load Balancing

Run the following command in the top left window of Cloud9 IDE to start a sender to send messages to NoB1.

java -jar ./bin/amazon-mq-client.jar -url $mesh1url -mode sender -type queue -destination workshop.queueA -name Sender-1

Once this done, give a couple of seconds to start the flow of messages, run the 2nd command to start a receiver on NoB2.

java -jar ./bin/amazon-mq-client.jar -url $mesh2url -mode receiver -type queue -destination workshop.queueA 

With both of the above commands running, you can see that while sender is producing messages to NoB1, a receiver is reading messages from the same queue from a different broker i.e. NoB2.

Now let’s run another receiver as follows.

java -jar ./bin/amazon-mq-client.jar -url $mesh3url -mode receiver -type queue -destination workshop.queueA 

The biggest advantage with Network of Brokers is that messages are available at any node. Now you should notice that messages are being distributed equally among two receivers and receivers are reading from the same queue on two different brokers. This is the result of conduitSubscriptions (false) that you learned earlier in this lab.

Stop the sender and receivers by holding CTRL + C or CONTROL + C in each terminal.