activemq-artemis/examples/features/standard/consumer-rate-limit
Justin Bertram b77cdaf773 ARTEMIS-1562 Refactor example documentation
This commit contains these changes:
* Change example documentation to use markdown
* Generate HTML doc based on markdown during release
* Fix XML formatting in some examples
* Repair out-of-date documentation
2017-12-15 14:54:16 +00:00
..
src/main ARTEMIS-765 Improve Checkstyle 2016-09-30 11:12:09 -04:00
pom.xml ARTEMIS-1562 Refactor example documentation 2017-12-15 14:54:16 +00:00
readme.md ARTEMIS-1562 Refactor example documentation 2017-12-15 14:54:16 +00:00

readme.md

JMS Message Consumer Rate Limiting

To run the example, simply type mvn verify from this directory, or mvn -PnoServer verify if you want to start and create the broker manually.

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 jndi.properties.

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 throttling.

Example step-by-step

In this example we specify a consumer-max-rate of 10 messages per second in the jndi.properties file when configuring the connection factory:

connectionFactory.ConnectionFactory=tcp://localhost:61616?consumerMaxRate=10

We then simply consume as many messages as we can in 10 seconds and note how many messages are actually consumed.

We note that the number of messages consumed per second never exceeds the specified value of 10 messages per second.