ARTEMIS-1562 update docs for slow-consumer example

This commit is contained in:
Justin Bertram 2017-10-24 14:20:37 -05:00 committed by Martyn Taylor
parent aa3b29080c
commit a685bf6e5c
7 changed files with 52 additions and 78 deletions

View File

@ -758,6 +758,12 @@ advanced *asynchronous send acknowledgements* feature to obtain
acknowledgement from the server that sends have been received and
processed in a separate stream to the sent messages.
Slow Consumer
-------------
The `slow-consumer` example shows you how to detect slow consumers and configure
a slow consumer policy in Apache ActiveMQ Artemis's
Spring Integration
------------------

View File

@ -15,8 +15,8 @@ resources.
## Configuration required for detecting slow consumers
By default the server will not detect slow consumers. If slow consumer
detection is desired then see [queue attributes chapter](queue-attributes.md)
for more details.
detection is desired then see [address model chapter](address-model.md)
for more details on the required address settings.
The calculation to determine whether or not a consumer is slow only
inspects the number of messages a particular consumer has
@ -33,3 +33,8 @@ are a high number of queues and the `slow-consumer-check-period` is
relatively low then there may be delays in executing some of the checks.
However, this will not impact the accuracy of the calculations used by
the detection algorithm. See [thread pooling](thread-pooling.md) for more details about this pool.
## Example
See the [examples](examples.md) chapter for an example which shows how to detect a slow consumer
with Apache ActiveMQ Artemis.

View File

@ -155,6 +155,7 @@ under the License.
<module>security</module>
<module>security-ldap</module>
<module>send-acknowledgements</module>
<module>slow-consumer</module>
<module>spring-integration</module>
<module>ssl-enabled</module>
<module>ssl-enabled-dual-authentication</module>

View File

@ -111,7 +111,23 @@ under the License.
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>markdown-page-generator-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -1,50 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<title>ActiveMQ Artemis JMS Slow Consumer Example</title>
<link rel="stylesheet" type="text/css" href="../../../common/common.css" />
<link rel="stylesheet" type="text/css" href="../../../common/prettify.css" />
<script type="text/javascript" src="../../../common/prettify.js"></script>
</head>
<body onload="prettyPrint()">
<h1>JMS Slow Consumer Example</h1>
<pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre>
<p>This example demonstrates Slow Consumer policy KILL and NOTIFY and the associated address-settings.</p>
<p>How often the broker checks for Slow Consumers is configurable by <b>slow-consumer-check-period</b> in the brokers address-settings. The default value is for
<b>slow-consumer-check-period</b> is 5 seconds. A broker considers a consumer slow if the <b>slow-consumer-threshold</b> is not been met. The
<b>slow-consumer-threshold</b> is the number of messages consumed by the consumer within a second. When a slow consumer is detected, the broker action depends
on which <b>slow-consumer-policy</b> is configured.</p>
<p>The <b>slow-consumer-policy</b> <b>KILL</b> will kill the consumers connection</p>
<p>The <b>slow-consumer-policy</b> <b>NOTIFY</b> will send a CONSUMER_SLOW management notification that an application can receive</p>
<p> There are 2 example clients:<p>
<p><b>KillSlowConsumerExample</b> sends messages to a queue "slow.consumer.kill". It then starts a consumer BUT does not consume any messages. It waits for 8 seconds and tries
to consume a message. It expects to receive an exception as the connection should already be closed.</p>
<p><b>NotifySlowConsumerExample</b> sends messages to a queue "slow.consumer.notify". It creates a consumer on the topic "notify.topic" that has been configured as the broker's
<b>management-notification-address</b>. It then starts a consumer on "slow.consumer.notify" BUT does not consume any messages. The consumer on "notify.topic" will receive a CONSUMER_SLOW management notification
and then stop the client.</p>
</body>
</html>

View File

@ -0,0 +1,17 @@
# JMS Slow Consumer Example
To run the example, simply type **mvn verify** from this directory, or **mvn -PnoServer verify** if you want to start and create the server manually.
This example demonstrates Slow Consumer policy KILL and NOTIFY and the associated address-settings.
How often the broker checks for Slow Consumers is configurable by **slow-consumer-check-period** in the brokers address-settings. The default value is for **slow-consumer-check-period** is 5 seconds. A broker considers a consumer slow if the **slow-consumer-threshold** is not been met. The **slow-consumer-threshold** is the number of messages consumed by the consumer within a second. When a slow consumer is detected, the broker action depends on which **slow-consumer-policy** is configured.
The **slow-consumer-policy** **KILL** will kill the consumers connection
The **slow-consumer-policy** **NOTIFY** will send a CONSUMER_SLOW management notification that an application can receive
There are 2 example clients:
**KillSlowConsumerExample** sends messages to a queue "slow.consumer.kill". It then starts a consumer BUT does not consume any messages. It waits for 8 seconds and tries to consume a message. It expects to receive an exception as the connection should already be closed.
**NotifySlowConsumerExample** sends messages to a queue "slow.consumer.notify". It creates a consumer on the topic "notify.topic" that has been configured as the broker's **management-notification-address**. It then starts a consumer on "slow.consumer.notify" BUT does not consume any messages. The consumer on "notify.topic" will receive a CONSUMER_SLOW management notification and then stop the client.

View File

@ -16,10 +16,8 @@ software distributed under the License is distributed on an
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--><configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
-->
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<core xmlns="urn:activemq:core">
<bindings-directory>./data/messaging/bindings</bindings-directory>
@ -40,26 +38,7 @@ under the License.
<!-- Other config -->
<security-settings>
<!--security for example queue-->
<security-setting match="slow.consumer.kill">
<permission roles="guest" type="createDurableQueue"/>
<permission roles="guest" type="deleteDurableQueue"/>
<permission roles="guest" type="createNonDurableQueue"/>
<permission roles="guest" type="deleteNonDurableQueue"/>
<permission roles="guest" type="consume"/>
<permission roles="guest" type="send"/>
</security-setting>
<security-setting match="slow.consumer.notify">
<permission roles="guest" type="createDurableQueue"/>
<permission roles="guest" type="deleteDurableQueue"/>
<permission roles="guest" type="createNonDurableQueue"/>
<permission roles="guest" type="deleteNonDurableQueue"/>
<permission roles="guest" type="consume"/>
<permission roles="guest" type="send"/>
</security-setting>
<security-setting match="notify.topic">
<security-setting match="#">
<permission roles="guest" type="createDurableQueue"/>
<permission roles="guest" type="deleteDurableQueue"/>
<permission roles="guest" type="createNonDurableQueue"/>