57 lines
3.1 KiB
HTML
57 lines
3.1 KiB
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 Delayed Redelivery 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>Delayed Redelivery 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 how ActiveMQ Artemis can be configured to provide a delayed redelivery in the case
|
|
where a message needs to be redelivered.</p>
|
|
<p>Delaying redelivery can often be useful in the case that clients regularly fail or roll-back. Without a delayed
|
|
redelivery, the system can get into a "thrashing" state, with delivery being attempted, the client rolling back, and
|
|
delivery being re-attempted ad infinitum in quick succession, using up valuable CPU and network resources.</p>
|
|
<p>Re-delivery occurs when the session is closed with unacknowledged messages. The unacknowledged messages will
|
|
be redelivered.</p>
|
|
<p>By providing a redelivery delay, it can be specified that a delay of, say, 10 seconds is implemented between rollback
|
|
and redelivery. The specific delay is configurable on both a global and per destination level, by using wild-card
|
|
matching on the address settings.</p>
|
|
|
|
<h2>Example setup</h2>
|
|
<p>Redelivery delay is specified in the configuration file <a href="src/main/resources/activemq/server0/broker.xml">broker.xml</a>:</p>
|
|
<p>In this example we set the redelivery delay to 5 seconds for the specific example queue. We could set redelivery delay on
|
|
on multiple queues by specifying a wild-card in the match, e.g. <code>match="jms.#"</code> would apply the settings
|
|
to all JMS queues and topics.</p>
|
|
<p>We then consume a message in a transacted session, and rollback, and note that the message is not redelivered until
|
|
after 5 seconds.</p>
|
|
<pre class="prettyprint">
|
|
<code><address-setting match="jms.queue.exampleQueue">
|
|
<redelivery-delay>5000</redelivery-delay>
|
|
</address-setting>
|
|
</code>
|
|
</pre>
|
|
</body>
|
|
</html>
|