Author: buildbot
Date: Wed Nov 30 15:23:16 2016
New Revision: 1001885
Log:
Production update by buildbot for activemq
Modified:
websites/production/activemq/content/cache/main.pageCache
websites/production/activemq/content/message-redelivery-and-dlq-handling.html
websites/production/activemq/content/redelivery-policy.html
Modified: websites/production/activemq/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified:
websites/production/activemq/content/message-redelivery-and-dlq-handling.html
==============================================================================
---
websites/production/activemq/content/message-redelivery-and-dlq-handling.html
(original)
+++
websites/production/activemq/content/message-redelivery-and-dlq-handling.html
Wed Nov 30 15:23:16 2016
@@ -82,15 +82,16 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h3
id="MessageRedeliveryandDLQHandling-Overview">Overview</h3><p>Messages are
redelivered to a client when <strong>any</strong> of the following
occurs:</p><ol><li>A transacted session is used and rollback() is
called.</li><li>A transacted session is closed before commit is
called.</li><li>A session is using CLIENT_ACKNOWLEDGE and Session.recover() is
called.</li><li>A client connection times out (perhaps the code being executed
takes longer than the configured time-out period)</li></ol><p>The broker
transmits the default delivery policy that he prefers to a client connection in
his BrokerInfo command packet. But the client can override the policy settings
by using the ActiveMQConnection.getRedeliveryPolicy() method:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+<div class="wiki-content maincontent"><h3
id="MessageRedeliveryandDLQHandling-Overview">Overview</h3><p>Messages are
redelivered to a client when <strong>any</strong> of the following
occurs:</p><ol><li>A transacted session is used
and <strong><code>rollback()</code></strong> is called.</li><li>A
transacted session is closed before <strong><code>commit()</code></strong>
is called.</li><li>A session is
using <strong><code>CLIENT_ACKNOWLEDGE</code></strong>
and <strong><code>Session.recover()</code></strong> is called.</li><li>A
client connection times out (perhaps the code being executed takes longer than
the configured time-out period).</li></ol><p>The broker transmits the default
delivery policy that he prefers to a client connection in
his <strong><code>BrokerInfo</code></strong> command packet. But the
client can override the policy settings by using
the <strong><code>ActiveMQConnection.getRedeliveryPolicy()</code></strong>
method:</p><div class="cod
e panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">RedeliveryPolicy policy =
connection.getRedeliveryPolicy();
policy.setInitialRedeliveryDelay(500);
policy.setBackOffMultiplier(2);
policy.setUseExponentialBackOff(true);
policy.setMaximumRedeliveries(2);
</pre>
-</div></div><p>Once a message's redelivery attempts exceeds the
maximumRedeliveries configured for the <a shape="rect"
href="redelivery-policy.html">Redelivery Policy</a>, a "Poison ack" is sent
back to the broker letting him know that the message was considered a poison
pill. The Broker then takes the message and sends it to a Dead Letter Queue so
that it can be analyzed later on.</p><p>The default Dead Letter Queue in
ActiveMQ is called ActiveMQ.DLQ; all undeliverable messages will get sent to
this queue and this can be difficult to manage. So, you can set an
"individualDeadLetterStrategy" in the destination policy map of the
<code>activemq.xml</code> configuration file, which allows you to specify a
specific dead letter queue prefix for a given queue or topic. You can apply
this strategy using wild card if you like so that all queues get their own
dead-letter queue, as is shown in the example below.</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><broker...>
+</div></div><p>Once a message's redelivery attempts exceeds
the <strong><code>maximumRedeliveries</code></strong> configured for the
<a shape="rect" href="redelivery-policy.html">Redelivery Policy</a>, a "Poison
ACK" is sent back to the broker letting him know that the message was
considered a poison pill. The Broker then takes the message and sends it to a
Dead Letter Queue so that it can be analyzed later on.</p><p>The default Dead
Letter Queue in ActiveMQ is called <strong><code>ActiveMQ.DLQ</code></strong>;
all un-deliverable messages will get sent to this queue and this can be
difficult to manage. So, you can set
an <strong><code>individualDeadLetterStrategy</code></strong> in the
destination policy map of the <strong><code>activemq.xml</code></strong>
configuration file, which allows you to specify a specific dead letter queue
prefix for a given queue or topic. You can apply this strategy using wild card
if you like so that all queues get their own dead-letter queue,
as is shown in the example below.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><broker>
+
<destinationPolicy>
<policyMap>
<policyEntries>
@@ -101,18 +102,18 @@ policy.setMaximumRedeliveries(2);
Use the prefix 'DLQ.' for the destination name, and make
the DLQ a queue rather than a topic
-->
- <individualDeadLetterStrategy
- queuePrefix="DLQ." useQueueForQueueMessages="true" />
+ <individualDeadLetterStrategy queuePrefix="DLQ."
useQueueForQueueMessages="true"/>
</deadLetterStrategy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
- ...
+
</broker>
</pre>
-</div></div><p>See the <a shape="rect"
href="redelivery-policy.html">Redelivery Policy</a> section for some more
detail on the policy options.</p><h3
id="MessageRedeliveryandDLQHandling-AutomaticallyDiscardExpiredMessages">Automatically
Discard Expired Messages</h3><p>Some folks simply need expired messages to be
discarded instead of sent to the DLQ (i.e., skip the DLQ entirely). This
simplifies the management of the DLQ so that you're not sifting through loads
of expired messages to find messages with real problems. To tell ActiveMQ to
just discard expired messages, configure the <code>processExpired</code>
property to false on a dead letter strategy:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><broker...>
+</div></div><p>See the <a shape="rect"
href="redelivery-policy.html">Redelivery Policy</a> section for some more
detail on the policy options.</p><h3
id="MessageRedeliveryandDLQHandling-AutomaticallyDiscardExpiredMessages">Automatically
Discard Expired Messages</h3><p>Some folks simply need expired messages to be
discarded instead of sent to the DLQ i.e., skip the DLQ entirely. This
simplifies the management of the DLQ so that you're not sifting through loads
of expired messages to find messages with real problems. To tell ActiveMQ to
just discard expired messages, configure the
<strong><code>processExpired</code></strong> property to false on a dead letter
strategy:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><broker>
+
<destinationPolicy>
<policyMap>
<policyEntries>
@@ -130,12 +131,13 @@ policy.setMaximumRedeliveries(2);
</policyEntries>
</policyMap>
</destinationPolicy>
-...
+
</broker>
</pre>
-</div></div><h3
id="MessageRedeliveryandDLQHandling-Placenon-persistentmessagesontothedead-letterqueue">Place
non-persistent messages onto the dead-letter queue</h3><p>By default, ActiveMQ
will not place undeliverable <em>non-persistent</em> messages on the
dead-letter queue. The rationale for this behavior is that if the application
doesn't care enough to make the message persistent, then there is little or no
value in recording that the message was undeliverable. If you do want to place
non-persistent messages on the dead-letter queue, then you should set
<code>processNonPersistent="true"</code> on the dead-letter strategy.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><broker...>
- <destinationPolicy>
+</div></div><h3
id="MessageRedeliveryandDLQHandling-PlaceNon-PersistentMessagesOntoTheDead-LetterQueue">Place
Non-Persistent Messages Onto The Dead-Letter Queue</h3><p>By default, ActiveMQ
will not place undeliverable <em>non-persistent</em> messages on the
dead-letter queue. The rationale for this behavior is that if the application
doesn't care enough to make the message persistent, then there is little or no
value in recording that the message was undeliverable. If you do want to place
non-persistent messages on the dead-letter queue, then you should set
<strong><code>processNonPersistent="true"</code></strong> on the dead-letter
strategy.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><broker>
+
+  <destinationPolicy>
<policyMap>
<policyEntries>
<!-- Set the following policy on all queues using the '>'
wildcard -->
@@ -151,77 +153,85 @@ policy.setMaximumRedeliveries(2);
</policyEntries>
</policyMap>
</destinationPolicy>
-...
+
</broker>
</pre>
-</div></div><h3
id="MessageRedeliveryandDLQHandling-SettingexpirationonmessagesintheDLQ">Setting
expiration on messages in the DLQ</h3><p>By default, ActiveMQ will never
expire messages sent to the DLQ but from v5.12, the deadLetterStrategy supports
an expiration attribute where the value is in milliseconds. Note, be selective
in how this is applied. In particular do not apply expiration to your DLQ
destinations by setting expiration on a default or inclusive wildcard policy
entry. If a DLQ entry expires and forwards to the same or another DLQ with
expiry, you will introduce a loop that can be problematic if the strategy audit
is disabled or it's sliding window is exceeded.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><broker...>
- <destinationPolicy>
+</div></div><h3
id="MessageRedeliveryandDLQHandling-SettingExpirationonMessagesintheDLQ">Setting
Expiration on Messages in the DLQ</h3><p>By default, ActiveMQ will
<strong><em>never</em></strong> expire messages sent to the DLQ. However, from
ActiveMQ 5.12 the <strong><code>deadLetterStrategy</code></strong>
supports an <strong><code>expiration</code></strong> attribute whose value
is given in milliseconds.</p><div class="confluence-information-macro
confluence-information-macro-warning"><span class="aui-icon aui-icon-small
aui-iconfont-error confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>Be selective in how this is
applied. In particular do not apply expiration to your DLQ destinations by
setting expiration on a default or inclusive wildcard policy entry.</p><p>If a
DLQ entry expires and forwards to the same or another DLQ with expiry, you will
introduce a loop that can be problematic if the strategy audit is disabled or
it's s
liding window is exceeded.</p></div></div><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><broker>
+
+  <destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry queue="QueueWhereItIsOkToExpireDLQEntries">
<deadLetterStrategy>
- <.... expiration="300000" />
+ <.... expiration="300000"/>
</deadLetterStrategy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
-...
+
</broker>
</pre>
-</div></div><h3
id="MessageRedeliveryandDLQHandling-TheDiscardingDLQPlugin">The Discarding DLQ
Plugin</h3><p> </p><p><note>: from 5.9 - a destination policyEntry
supports a deadLetterStrategy of discarding,</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"><deadLetterStrategy><discarding/></deadLetterStrategy></pre>
-</div></div><p>that does the same thing as this plugin but on a per
destination basis. The matching based on regular expressions of the plugin is a
bit more powerful than destination matching so the plugin may still be useful
in some cases. </end note></p><p> </p><p>A very simple yet very
useful plugin to the broker. This plugin allows the configuration of queues and
topics, all or matched based on <a shape="rect" class="external-link"
href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html"
rel="nofollow">Java SE regular expressions</a>, to drop messages that have been
sent to the DLQ. This is extremely useful when using <a shape="rect"
href="slow-consumer-handling.html">constant pending message limit strategy</a>
or the other eviction rules, but you don't want to incur the overhead of yet
another consumer to clear the DLQ.</p><p>Below is an example of a basic
configuration to drop everything:</p><div class="code panel pdl"
style="border-width: 1px;"><
div class="codeContent panelContent pdl">
+</div></div><h3
id="MessageRedeliveryandDLQHandling-TheDiscardingDLQPlugin">The Discarding DLQ
Plugin</h3><p> </p><div class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>From ActiveMQ 5.9 - a
destination <strong><code>policyEntry</code></strong> supports
a <strong><code>deadLetterStrategy</code></strong> of discarding:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><deadLetterStrategy>
+ <discarding/>
+</deadLetterStrategy></pre>
+</div></div><p>This does the same thing as the plugin but on a per destination
basis. The matching based on regular expressions of the plugin is a bit more
powerful than destination matching so the plugin may still be useful in some
cases.</p></div></div><p> </p><p>A very simple yet very useful plugin to
the broker. This plugin allows the configuration of queues and topics, all or
matched based on <a shape="rect" class="external-link"
href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html"
rel="nofollow">Java SE regular expressions</a>, to drop messages that have been
sent to the DLQ. This is extremely useful when using <a shape="rect"
href="slow-consumer-handling.html">constant pending message limit strategy</a>
or the other eviction rules, but you don't want to incur the overhead of yet
another consumer to clear the DLQ.</p><p>Below is an example of a basic
configuration to drop everything:</p><div class="code panel pdl"
style="border-width: 1px;"><div cla
ss="codeContent panelContent pdl">
<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><beans>
- <broker ...>
+ <broker>
<plugins>
- <discardingDLQBrokerPlugin dropAll="true" dropTemporaryTopics="true"
dropTemporaryQueues="true" />
+ <discardingDLQBrokerPlugin dropAll="true" dropTemporaryTopics="true"
dropTemporaryQueues="true"/>
</plugins>
</broker>
</beans>
</pre>
</div></div><p>Below is a slightly more complex example:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><beans>
- <broker ...>
+ <broker>
<plugins>
- <discardingDLQBrokerPlugin dropOnly="MY.EXAMPLE.TOPIC.29
MY.EXAMPLE.QUEUE.87" reportInterval="1000" />
+ <discardingDLQBrokerPlugin dropOnly="MY.EXAMPLE.TOPIC.29
MY.EXAMPLE.QUEUE.87" reportInterval="1000"/>
</plugins>
</broker>
</beans>
</pre>
-</div></div><ul><li>Notice that destination names are space
delimited.</li><li>The reportInterval property is used to denote how frequently
do we output how many messages we have dropped - use 0 to
disable.</li></ul><p>Below is an even more complex example:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><ul><li>Notice that destination names are space
delimited.</li><li>The <strong><code>reportInterval</code></strong>
property is used to denote how frequently do we output how many messages we
have dropped - use <strong><code>0</code></strong> to
disable.</li></ul><p>Below is an even more complex example:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><beans>
- <broker ...>
+ <broker>
<plugins>
- <discardingDLQBrokerPlugin dropOnly="MY.EXAMPLE.TOPIC.[0-9]{3}
MY.EXAMPLE.QUEUE.[0-9]{3}" reportInterval="3000" />
+ <discardingDLQBrokerPlugin dropOnly="MY.EXAMPLE.TOPIC.[0-9]{3}
MY.EXAMPLE.QUEUE.[0-9]{3}" reportInterval="3000"/>
</plugins>
</broker>
</beans>
</pre>
-</div></div><ul><li>Notice that the destination names use regular expressions.
These match the number 000..999 at the end of each destination
name.</li></ul><p>For more information, see the source code for the <a
shape="rect" class="external-link"
href="https://svn.apache.org/repos/asf/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBrokerPlugin.java">DiscardingDLQBrokerPlugin</a>
and the <a shape="rect" class="external-link"
href="https://svn.apache.org/repos/asf/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBroker.java">DiscardingDLQBroker</a></p><h3
id="MessageRedeliveryandDLQHandling-BrokerRedelivery(v5.7)">Broker Redelivery
(v5.7)</h3><p>Typically a consumer handles redelivery so that it can maintain
message order while a message appears as inflight on the broker.<br
clear="none"> This means that redelivery is limited to a single consumer unless
that consumer terminates. In this way the broker is unawar
e of redelivery.<br clear="none"> With broker redelivery, it is possible to
have the broker redeliver a message after a delay using a resend. This is
implemented by a broker plugin that handles dead letter processing by
redelivery via the scheduler. This is useful when total message order is not
important and where through put and load distribution among consumers is. With
broker redelivery, messages that fail delivery to a given consumer can get
immediately re-dispatched.<br clear="none"> The feature is enabled via xml
configuration of the form:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><broker
xmlns="http://activemq.apache.org/schema/core" schedulerSupport="true" >
- ....
+</div></div><ul><li>Notice that the destination names use regular expressions.
These match the number <strong><code>000..999</code></strong> at the end
of each destination name.</li></ul><p>For more information, see the source code
for the <a shape="rect" class="external-link"
href="https://svn.apache.org/repos/asf/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBrokerPlugin.java">DiscardingDLQBrokerPlugin</a>
and the <a shape="rect" class="external-link"
href="https://svn.apache.org/repos/asf/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBroker.java">DiscardingDLQBroker</a></p><h3
id="MessageRedeliveryandDLQHandling-BrokerRedelivery(v5.7)">Broker Redelivery
(v5.7)</h3><p>Typically a consumer handles redelivery so that it can maintain
message order while a message appears as inflight on the broker. This means
that redelivery is limited to a single consumer unless that consumer
terminates. In this way th
e broker is unaware of redelivery. With broker redelivery, it is possible to
have the broker redeliver a message after a delay using a resend. This is
implemented by a broker plugin that handles dead letter processing by
redelivery via the scheduler. This is useful when total message order is not
important and where through put and load distribution among consumers is. With
broker redelivery, messages that fail delivery to a given consumer can get
immediately re-dispatched.</p><p><br clear="none"> The feature is enabled via
XML configuration as follows:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><broker schedulerSupport="true">
+
<plugins>
- <redeliveryPlugin fallbackToDeadLetter="true"
sendToDlqIfMaxRetriesExceeded="true">
+ <redeliveryPlugin fallbackToDeadLetter="true"
+ sendToDlqIfMaxRetriesExceeded="true">
<redeliveryPolicyMap>
<redeliveryPolicyMap>
<redeliveryPolicyEntries>
<!-- a destination specific policy -->
- <redeliveryPolicy queue="SpecialQueue"
maximumRedeliveries="4"
-redeliveryDelay="10000" />
+ <redeliveryPolicy queue="SpecialQueue"
+ maximumRedeliveries="4"
+ redeliveryDelay="10000"/>
</redeliveryPolicyEntries>
- <!-- the fallback policy for all other destinations
-->
+  
<defaultEntry>
- <redeliveryPolicy maximumRedeliveries="4"
initialRedeliveryDelay="5000"
-redeliveryDelay="10000" />
+ <!-- the fallback policy for all other
destinations -->
+   <redeliveryPolicy maximumRedeliveries="4"
+ initialRedeliveryDelay="5000"
+ redeliveryDelay="10000"/>
</defaultEntry>
</redeliveryPolicyMap>
</redeliveryPolicyMap>
</redeliveryPlugin>
</plugins>
-</pre>
-</div></div><p>The familiar <a shape="rect"
href="redelivery-policy.html">Redelivery Policy</a> has been extended to take a
matching destination.<br clear="none"> fallbackToDeadLetter controls the action
when there is no matching redeliver policy for a destination. Defaults to true
so regular DLQ processing ensues.<br clear="none">
sendToDlqIfMaxRetriesExceeded controls the action when the retry limit is
exceeded. Defaults to true so regular DLQ processing ensues. When false, the
message is dropped.</p><ul><li>Note: broker schedulerSupport must be enabled
for this feature to work.</li></ul></div>
+
+</broker> </pre>
+</div></div><p>The familiar <a shape="rect"
href="redelivery-policy.html">Redelivery Policy</a> has been extended to take a
matching destination.
<strong><code>fallbackToDeadLetter</code></strong>controls the action when
there is no matching redeliver policy for a destination. Defaults
to <strong><code>true</code></strong> so regular DLQ processing ensues.
<strong><code>sendToDlqIfMaxRetriesExceeded</code></strong> controls the action
when the retry limit is exceeded. Defaults to true so regular DLQ processing
ensues. When <strong><code>false</code></strong>, the message is
dropped.</p><div class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body">ActiveMQ's
<strong><code>schedulerSupport</code></strong> must be enabled for this feature
to work.</div></div></div>
</td>
<td valign="top">
<div class="navigation">
Modified: websites/production/activemq/content/redelivery-policy.html
==============================================================================
--- websites/production/activemq/content/redelivery-policy.html (original)
+++ websites/production/activemq/content/redelivery-policy.html Wed Nov 30
15:23:16 2016
@@ -81,27 +81,8 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2
id="RedeliveryPolicy-RedeliveryPolicy">Redelivery Policy</h2>
-
-<p>Detail on when messages are redelivered to a client can be found in the <a
shape="rect" href="message-redelivery-and-dlq-handling.html">Message Redelivery
and DLQ Handling</a> section.</p>
-
-<p>You can configure the <a shape="rect" class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/RedeliveryPolicy.java?view=markup">RedeliveryPolicy</a>
on your <a shape="rect" class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java?view=markup">ActiveMQConnectionFactory</a>
or <a shape="rect" class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java?view=markup">ActiveMQConnection</a>
to customize exactly how you want the redelivery to work.</p>
-
-<p>You can use Java code, Spring or the <a shape="rect"
href="connection-configuration-uri.html">Connection Configuration URI</a> to
customise this.</p>
-
-<h3 id="RedeliveryPolicy-AvailableProperties">Available Properties</h3>
-
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p>Property</p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th
colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> collisionAvoidanceFactor </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> 0.15 </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> The percentage of range of collision
avoidance if enabled </p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p> maximumRedeliveries </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> 6 </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Sets the maximum number of times a message will be
redelivered before it is considered a <strong>poisoned pill</strong> and
returned to the broker so it can go to a Dead Letter Queue (use value -1 to
define infinite number o
f redeliveries) </p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p> maximumRedeliveryDelay </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> -1 </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Sets the maximum delivery delay that will be applied
if the useExponentialBackOff option is set. (use value -1 to define that no
maximum be applied) (<span style="color: red;">v5.5</span>)
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
initialRedeliveryDelay </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> 1000L </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> The initial redelivery delay in milliseconds
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
redeliveryDelay </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>
1000L</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The delivery
delay if initialRedeliveryDelay is 0 (<span style="color: red;">v5.4</spa
n>) </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
useCollisionAvoidance </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> false </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Should the redelivery policy use collision avoidance
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
useExponentialBackOff </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> false </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Should exponential back-off be used (i.e. to
exponentially increase the timeout) </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> backOffMultiplier </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> 5 </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> The back-off multiplier
</p></td></tr></tbody></table></div>
-
-
-<h2 id="RedeliveryPolicy-RedeliveryPolicyperDestination">RedeliveryPolicy per
Destination</h2>
-
-<p>As of ActiveMQ v5.7.0 you can now configure a <a shape="rect"
class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/RedeliveryPolicy.java?view=markup">RedeliveryPolicy</a>
on a per-destination bases. The ActiveMQConnection factory class now exposes
a <a shape="rect" class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/broker/region/policy/RedeliveryPolicyMap.java?view=markup">RedeliveryPolicyMap</a>
property that allows to assign a RedeliveryPolicy using named destinations or
using destination wildcards. The code snipped below shows how to configure a
different <a shape="rect" class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/RedeliveryPolicy.java?view=markup">RedeliveryPolicy</a>
for Topics and Queues. </p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
-
- ActiveMQConnection connection ... // Create a connection
+<div class="wiki-content maincontent"><h2
id="RedeliveryPolicy-RedeliveryPolicy">Redelivery Policy</h2><p>Detail on when
messages are redelivered to a client can be found in the <a shape="rect"
href="message-redelivery-and-dlq-handling.html">Message Redelivery and DLQ
Handling</a> section. You can configure the <a shape="rect"
class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/RedeliveryPolicy.java?view=markup">RedeliveryPolicy</a>
on your <a shape="rect" class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java?view=markup">ActiveMQConnectionFactory</a>
or <a shape="rect" class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java?view=markup">ActiveMQConnection</a>
to customize exactly how you want the redelivery to work.</p><p>You c
an use Java code, Spring or the <a shape="rect"
href="connection-configuration-uri.html">Connection Configuration URI</a> to
customize this.</p><h3 id="RedeliveryPolicy-AvailableProperties">Available
Properties</h3><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Property</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>backOffMultiplier</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>5</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The back-off
multiplier.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>collisionAvoidanceFactor</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>0.15</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The
percentage of range of collision avoidance if enabled.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>initialRedeliveryDelay</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>1000L</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The initial redelivery delay in
milliseconds.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>maximumRedeliveries</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>6</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Sets the maximum number of
times a message will be redelivered before it is considered a <strong>poisoned
pill</strong> and returned to the broker so it can go to a Dead Letter
Queue.</p><p>Set to <strong><code>-1</code></strong> for unlimited
redeliveries.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>maximumRedeliveryDelay</code></p></td><td
colspan="1" rowspan="1" class="confluenc
eTd"><p><code>-1</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Sets the maximum delivery delay that will be applied if
the <strong><code>useExponentialBackOff</code></strong> option is set.
(use value <strong><code>-1</code></strong> to define that no maximum be
applied) (<span style="color: red;">v5.5</span>).</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>redeliveryDelay</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>1000L</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The delivery delay
if <strong><code>initialRedeliveryDelay=0</code></strong> (<span
style="color: red;">v5.4</span>).</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>useCollisionAvoidance</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Should the redelivery policy
use collision avoidan
ce.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>useExponentialBackOff</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Should exponential back-off be
used, i.e., to exponentially increase the
timeout.</p></td></tr></tbody></table></div><h2
id="RedeliveryPolicy-RedeliveryPolicyperDestination">RedeliveryPolicy per
Destination</h2><p>As of ActiveMQ v5.7.0 you can now configure a <a
shape="rect" class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/RedeliveryPolicy.java?view=markup">RedeliveryPolicy</a>
on a per-destination bases.
The <strong><code>ActiveMQConnection</code></strong> factory class now
exposes a <a shape="rect" class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/broker/region/policy/RedeliveryPolicyMap.jav
a?view=markup">RedeliveryPolicyMap</a> property that allows to assign a
RedeliveryPolicy using named destinations or using destination wildcards. The
code snipped below shows how to configure a different <a shape="rect"
class="external-link"
href="http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/RedeliveryPolicy.java?view=markup">RedeliveryPolicy</a>
for Topics and Queues.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"> ActiveMQConnection connection ... // Create a
connection
RedeliveryPolicy queuePolicy = new RedeliveryPolicy();
queuePolicy.setInitialRedeliveryDelay(0);