/shared-consumers

A simple example of how to use shared consumers on different threads in Red Hat AMQ

Primary LanguageJava

AMQ shared consumers listening from different threads in the same topic

This is a small sample of how to consume, using QPID, from different threads in a multicast address on a Red AMQ 7 broker. Use it as reference for your own implementation.

Configuration

  1. Edit the src/main/resources/jndi.properties file and add your broker credentials to it.

  2. Create a multicast address in your broker.xml file.

<address name="exampleTopic">
	<multicast/>
</address>
  1. Run the Consumer1.java and Consumer2.java to create consumers that will listen for messages on the topic.

  2. Run the Producer.java. A message must be sent to the topic and one of the consumers should consume it.

  3. Alternatively, comment line 32 and uncomment line 33 in class Producer.java.

  4. Run the Producer.java again. A message must be sent to the topic and the another consumer should consume it.