From a685bf6e5c1ef241ad69dead8decb9d8b3bb2018 Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Tue, 24 Oct 2017 14:20:37 -0500 Subject: [PATCH] ARTEMIS-1562 update docs for slow-consumer example --- 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 +++++++- .../standard/slow-consumer/readme.html | 50 ------------------- .../features/standard/slow-consumer/readme.md | 17 +++++++ .../resources/activemq/server0/broker.xml | 27 ++-------- 7 files changed, 52 insertions(+), 78 deletions(-) delete mode 100644 examples/features/standard/slow-consumer/readme.html create mode 100644 examples/features/standard/slow-consumer/readme.md diff --git a/docs/user-manual/en/examples.md b/docs/user-manual/en/examples.md index 36d46844f8..8bf8c80858 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 ------------------ diff --git a/docs/user-manual/en/slow-consumers.md b/docs/user-manual/en/slow-consumers.md index 81e9f244f3..afca530f48 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. diff --git a/examples/features/standard/pom.xml b/examples/features/standard/pom.xml index 6a1a598f9a..d254992703 100644 --- a/examples/features/standard/pom.xml +++ b/examples/features/standard/pom.xml @@ -155,6 +155,7 @@ under the License. security security-ldap send-acknowledgements + slow-consumer spring-integration ssl-enabled ssl-enabled-dual-authentication diff --git a/examples/features/standard/slow-consumer/pom.xml b/examples/features/standard/slow-consumer/pom.xml index 79904f98bc..239f10eeb5 100644 --- a/examples/features/standard/slow-consumer/pom.xml +++ b/examples/features/standard/slow-consumer/pom.xml @@ -111,7 +111,23 @@ under the License. + + org.apache.maven.plugins + maven-clean-plugin + - - + + + release + + + + com.vladsch.flexmark + markdown-page-generator-plugin + + + + + + \ No newline at end of file diff --git a/examples/features/standard/slow-consumer/readme.html b/examples/features/standard/slow-consumer/readme.html deleted file mode 100644 index 19bbd21e54..0000000000 --- a/examples/features/standard/slow-consumer/readme.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - ActiveMQ Artemis JMS Slow Consumer Example - - - - - -

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.

- - - - diff --git a/examples/features/standard/slow-consumer/readme.md b/examples/features/standard/slow-consumer/readme.md new file mode 100644 index 0000000000..3501aa4d28 --- /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 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 e41fcaff26..c8c927ae72 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. ---> - - - +--> + ./data/messaging/bindings @@ -40,26 +38,7 @@ under the License. - - - - - - - - - - - - - - - - - - - - +