activemq-artemis/examples/features/standard/consumer-rate-limit
Martyn Taylor c512f12a34 [maven-release-plugin] prepare release 1.1.0 2015-09-11 19:01:19 +01:00
..
src/main renaming broker-features -> features on examples 2015-08-13 00:11:56 -04:00
pom.xml [maven-release-plugin] prepare release 1.1.0 2015-09-11 19:01:19 +01:00
readme.html renaming broker-features -> features on examples 2015-08-13 00:11:56 -04:00

readme.html

<!--
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 Message Consumer Rate Limiting</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 Message Consumer Rate Limiting</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>With ActiveMQ Artemis you can specify a maximum consume rate at which a JMS MessageConsumer will consume messages.
     This can be specified when creating or configuring the connection factory. See <code>jndi.properties</code>.</p>
     <p>If this value is specified then ActiveMQ Artemis will ensure that messages are never consumed at a rate higher than
     the specified rate. This is a form of consumer <i>throttling</i>.</p>
     <h2>Example step-by-step</h2>
     <p>In this example we specify a <code>consumer-max-rate</code> of <code>10</code> messages per second in the <code>jndi.properties</code>
     file when configuring the connection factory:</p>
     <pre class="prettyprint">
     <code>
connectionFactory.ConnectionFactory=tcp://localhost:61616?consumerMaxRate=10
     </code>
     </pre>
     <p>We then simply consume as many messages as we can in 10 seconds and note how many messages are actually consumed.</p>
     <p>We note that the number of messages consumed per second never exceeds the specified value of <code>10</code> messages per second.</p>

  </body>
</html>