<!--
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>