ARTEMIS-853 - Add documents

Exclusive Queue documents added to detail behaviour and how to configure.
Also update docuents for last-value queue to cover addtional ways to configure
This commit is contained in:
Michael André Pearce 2018-02-20 08:39:37 +00:00
parent 34146c0cef
commit 03f4a52f1f
4 changed files with 105 additions and 4 deletions

View File

@ -33,6 +33,7 @@
* [Paging](paging.md)
* [Scheduled Messages](scheduled-messages.md)
* [Last-Value Queues](last-value-queues.md)
* [Exclusive Queues](exclusive-queues.md)
* [Message Grouping](message-grouping.md)
* [Extra Acknowledge Modes](pre-acknowledge.md)
* [Management](management.md)

View File

@ -427,6 +427,28 @@ Open the file <broker-instance>/etc/broker.xml for editing.
</configuration>
```
#### Pre-configuring a queue as an exclusive consumer queue
If a user requires to pre-create a queue that routes exclusively to one active consumer the **exclusive** flag can be enabled on the queue.
When **exclusive** is set to **true**. The queue will route messages to the a single active consumer. When the active consumer that is being routed to is detached from the queue, if another active consumer exist, one will be chosen and routing will now be exclusive to it.
See [Exclusive Queue](exclusive.md) for further information.
Open the file <broker-instance>/etc/broker.xml for editing.
```xml
<configuration ...>
<core ...>
...
<address name="foo.bar">
<multicast>
<queue name="orders1" exclusive="true"/>
</multicast>
</address>
</core>
</configuration>
```
## Additional Information: Protocol Managers, Address
A protocol manager maps protocol specific concepts down to the Apache ActiveMQ Artemis core model of addresses, queues and routing types. For example, when a client sends a MQTT subscription packet with the addresses

View File

@ -0,0 +1,53 @@
# Exclusive Queues
Exclusive queues are special queues which route all messages to only one
consumer at a time.
This is useful when you want all messages to be processed serially by the same consumer,
when a producer does not specify [Message Grouping](message-grouping.md).
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 pre configured at the address queue level
```xml
<configuration ...>
<core ...>
...
<address name="foo.bar">
<multicast>
<queue name="orders1" exclusive="true"/>
</multicast>
</address>
</core>
</configuration>
```
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, `exclusive-queue` is false. Address wildcards can be used
to configure Exclusive queues for a set of addresses (see [here](wildcard-syntax.md)).
## Example
See `org.apache.activemq.artemis.tests.integration.jms.client.ExclusiveTest`

View File

@ -10,14 +10,39 @@ are only interested by the latest value for a particular stock.
## Configuring Last-Value Queues
Last-value queues are defined in the address-setting configuration:
Last-Value queues can be pre configured at the address queue level
```xml
<configuration ...>
<core ...>
...
<address name="foo.bar">
<multicast>
<queue name="orders1" last-value="true"/>
</multicast>
</address>
</core>
</configuration>
```
Specified on creating a Queue by using the CORE api specifying the parameter `lastValue` 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?last-value=true");
Topic topic = session.createTopic("my.destination.name?last-value=true");
Also the default for all queues under and address can be defaulted using the address-setting configuration:
<address-setting match="lastValueQueue">
<last-value-queue>true</last-value-queue>
<default-last-value-queue>true</default-last-value-queue>
</address-setting>
By default, `last-value-queue` is false. Address wildcards can be used
to configure Last-Value queues for a set of addresses (see [here](wildcard-syntax.md)).
By default, `default-last-value-queue` is false.
Address wildcards can be used to configure Last-Value queues
for a set of addresses (see [here](wildcard-syntax.md)).
Note that address-setting `last-value-queue` config is deprecated, please use `default-last-value-queue` instead.
## Using Last-Value Property