Two Senders Two Receivers

Select the top right terminal and start a second sender. Now you have 2 clients sending messages to the same queue. We use a different name in order to distinguish the sender of the messages. Copy and paste the command below:

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

You can see that multiple senders can send messages to the same queue, and multiple receivers can receive messages from the same queue. But you will also observe that each message is only delivered to one receiver, not both. You will also observe that there is no direct relationship between sender and receiver.

Try to stop the receiver using CTRL + C in one of the lower windows to see what changes. You should notice that all the messages are now going to one receiver. Start the receive up again and now you should see the messages load-balanced between the receivers, and the messages are getting processed twice as fast.