activemq-artemis/examples/features/standard/exclusive-queue
Clebert Suconic 516b1a1b9f [maven-release-plugin] prepare for next development iteration 2019-03-14 12:41:04 -04:00
..
src/main ARTEMIS-1815 adding exclusive-queue example 2018-04-17 16:58:30 -04:00
pom.xml [maven-release-plugin] prepare for next development iteration 2019-03-14 12:41:04 -04:00
readme.md ARTEMIS-1815 adding exclusive-queue example 2018-04-17 16:58:30 -04:00

readme.md

JMS Exclusive Queue Example

To run the example, simply type mvn verify from this directory, or mvn -PnoServer verify if you want to start and create the broker manually.

This example shows you how to configure ActiveMQ Artemis so all messages are delivered to the same consumer

ExclusiveQueueExample.java

The broker is configured (using 'address-settings'), so that the queue is exclusive and will deliver all messages to the same consumer

 <address-settings>
            <address-setting match="my.exclusive.queue">
                <default-exclusive-queue>true</default-exclusive-queue>
            </address-setting>
 </address-settings>

ExclusiveQueueClientSideExample.java

The JMS Queue is auto created from the client code and uses the exclusive parameter.

Queue queue = session.createQueue("client.side.exclusive.queue?exclusive=true");

This example also shows that all remaining messages are sent to another consumer when the first consumer (that was receiving all messages), is closed.