activemq-artemis/examples/features/standard/expiry
Clebert Suconic 28919b6ad8 [maven-release-plugin] prepare for next development iteration 2020-10-30 10:16:29 -04:00
..
src/main ARTEMIS-1562 Refactor example documentation 2017-12-15 14:54:16 +00:00
pom.xml [maven-release-plugin] prepare for next development iteration 2020-10-30 10:16:29 -04:00
readme.md ARTEMIS-1562 Refactor example documentation 2017-12-15 14:54:16 +00:00

readme.md

JMS Expiration Example

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.

This example shows you how to configure ActiveMQ Artemis so messages are expipired after a certain time.

Messages can be retained in the messaging system for a limited period of time before being removed. JMS specification states that clients should not receive messages that have been expired (but it does not guarantee this will not happen).

ActiveMQ Artemis can assign a expiry address to a given queue so that when messages are expired, they are removed from the queue and routed to this address. These "expired" messages can later be consumed for further inspection.

The example will send 1 message with a short time-to-live to a queue. We will wait for the message to expire and checks that the message is no longer in the queue it was sent to. We will instead consume it from an expiry queue where it was moved when it expired.

Example setup

Expiry destinations are defined in the configuration file broker.xml.

This configuration will moved expired messages from the exampleQueue to the expiryQueue.