activemq-artemis/docs/user-manual/en/exclusive-queues.md
Justin Bertram 2dc76bd9f4
ARTEMIS-3657 refactor address docs
Mainly refactoring the address docs. This commit has the following
changes:

 - Remove examples for discouraged use-cases (e.g. using anycast and
multicast on the same address).
 - Reword to use configuration terms wherever possible. For example,
instead of saying "point-to-point" (which is not a configuration term)
say "anycast". References to things like "point-to-point" and
"publish-subscribe" are still there since users are familiar with these
terms. They're just used much less often.
 - Remove duplicate explanation of exclusive queues.
 - Remove duplicate explanation of auto-create and auto-delete elements.
 - Re-create graphics and include the master SVGs for potential updates
later.
 - Give non-destructive queues its own chapter.
 - Add details about specifying routing type using a message property.
 - Update the styling on the user manual's cover page to look better.
 - Lots of re-wording for clarity's sake.
 - Re-order sub-sections for clarity's sake.
 - Break up the address model and the settings documentation. The
settings documentation is large and deserves its own chapter. The
original anchor link is still available with a link to the new chapter.

In general the address-specific documentation should be much more clear,
concise, and consistent now.
2022-02-26 15:14:32 -06:00

1.7 KiB

Exclusive Queues

Exclusive queues are special queues which dispatch all messages to only one consumer at a time.

This is useful when you want all messages to be processed serially but you can't or don't want to use Message Grouping.

An example might be orders sent to an address and you need to consume them in the exact same order they were produced.

Obviously exclusive queues have a draw back that you cannot scale out the consumers to improve consumption as only one consumer would technically be active. Here we advise that you look at message groups first.

Configuring Exclusive Queues

Exclusive queues can be statically configured using the exclusive boolean property:

<address name="foo.bar">
   <multicast>
      <queue name="orders1" exclusive="true"/>
   </multicast>
</address>

Specified on creating a Queue by using the CORE api specifying the parameter exclusive to true.

Or on auto-create when using the JMS Client by using address parameters when creating the destination used by the consumer.

Queue queue = session.createQueue("my.destination.name?exclusive=true");
Topic topic = session.createTopic("my.destination.name?exclusive=true");

Also the default for all queues under and address can be defaulted using the address-setting configuration:

<address-setting match="lastValueQueue">
   <default-exclusive-queue>true</default-exclusive-queue>
</address-setting>

By default, default-exclusive-queue is false. Address wildcards can be used to configure exclusive queues for a set of addresses.

Example

See the exclusive queue example which shows how exclusive queues are configured and used with JMS.