ARTEMIS-1562 update docs for slow-consumer example
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/a685bf6e Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/a685bf6e Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/a685bf6e Branch: refs/heads/master Commit: a685bf6e5c1ef241ad69dead8decb9d8b3bb2018 Parents: aa3b290 Author: Justin Bertram <jbert...@apache.org> Authored: Tue Oct 24 14:20:37 2017 -0500 Committer: Martyn Taylor <mtay...@redhat.com> Committed: Mon Dec 18 11:34:11 2017 +0000 ---------------------------------------------------------------------- docs/user-manual/en/examples.md | 6 +++ docs/user-manual/en/slow-consumers.md | 9 +++- examples/features/standard/pom.xml | 1 + .../features/standard/slow-consumer/pom.xml | 20 +++++++- .../features/standard/slow-consumer/readme.html | 50 -------------------- .../features/standard/slow-consumer/readme.md | 17 +++++++ .../main/resources/activemq/server0/broker.xml | 27 ++--------- 7 files changed, 52 insertions(+), 78 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a685bf6e/docs/user-manual/en/examples.md ---------------------------------------------------------------------- diff --git a/docs/user-manual/en/examples.md b/docs/user-manual/en/examples.md index 36d4684..8bf8c80 100644 --- a/docs/user-manual/en/examples.md +++ b/docs/user-manual/en/examples.md @@ -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 ------------------ http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a685bf6e/docs/user-manual/en/slow-consumers.md ---------------------------------------------------------------------- diff --git a/docs/user-manual/en/slow-consumers.md b/docs/user-manual/en/slow-consumers.md index 81e9f24..afca530 100644 --- a/docs/user-manual/en/slow-consumers.md +++ b/docs/user-manual/en/slow-consumers.md @@ -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. http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a685bf6e/examples/features/standard/pom.xml ---------------------------------------------------------------------- diff --git a/examples/features/standard/pom.xml b/examples/features/standard/pom.xml index 6a1a598..d254992 100644 --- a/examples/features/standard/pom.xml +++ b/examples/features/standard/pom.xml @@ -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> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a685bf6e/examples/features/standard/slow-consumer/pom.xml ---------------------------------------------------------------------- diff --git a/examples/features/standard/slow-consumer/pom.xml b/examples/features/standard/slow-consumer/pom.xml index 79904f9..239f10e 100644 --- a/examples/features/standard/slow-consumer/pom.xml +++ b/examples/features/standard/slow-consumer/pom.xml @@ -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> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a685bf6e/examples/features/standard/slow-consumer/readme.html ---------------------------------------------------------------------- diff --git a/examples/features/standard/slow-consumer/readme.html b/examples/features/standard/slow-consumer/readme.html deleted file mode 100644 index 19bbd21..0000000 --- a/examples/features/standard/slow-consumer/readme.html +++ /dev/null @@ -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> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a685bf6e/examples/features/standard/slow-consumer/readme.md ---------------------------------------------------------------------- diff --git a/examples/features/standard/slow-consumer/readme.md b/examples/features/standard/slow-consumer/readme.md new file mode 100644 index 0000000..3501aa4 --- /dev/null +++ b/examples/features/standard/slow-consumer/readme.md @@ -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. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a685bf6e/examples/features/standard/slow-consumer/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/features/standard/slow-consumer/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/slow-consumer/src/main/resources/activemq/server0/broker.xml index e41fcaf..c8c927a 100644 --- a/examples/features/standard/slow-consumer/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/slow-consumer/src/main/resources/activemq/server0/broker.xml @@ -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"/>