Author: buildbot
Date: Tue Mar 3 12:21:39 2015
New Revision: 942137
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
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
Tue Mar 3 12:21:39 2015
@@ -82,31 +82,15 @@
<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></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">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-RedeliveryPolicy policy = connection.getRedeliveryPolicy();
+<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></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">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[RedeliveryPolicy policy =
connection.getRedeliveryPolicy();
policy.setInitialRedeliveryDelay(500);
policy.setBackOffMultiplier(2);
policy.setUseExponentialBackOff(true);
policy.setMaximumRedeliveries(2);
]]></script>
-</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">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<broker...>
+</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">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<broker...>
<destinationPolicy>
<policyMap>
<policyEntries>
@@ -127,17 +111,8 @@ policy.setMaximumRedeliveries(2);
...
</broker>
]]></script>
-</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">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<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 <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">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<broker...>
<destinationPolicy>
<policyMap>
<policyEntries>
@@ -158,15 +133,8 @@ policy.setMaximumRedeliveries(2);
...
</broker>
]]></script>
-</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">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<broker...>
+</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">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<broker...>
<destinationPolicy>
<policyMap>
<policyEntries>
@@ -186,17 +154,24 @@ policy.setMaximumRedeliveries(2);
...
</broker>
]]></script>
-</div></div>
-
-<h3 id="MessageRedeliveryandDLQHandling-TheDiscardingDLQPlugin">The Discarding
DLQ Plugin </h3>
-
-<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#SlowConsumerHandling-ConstantPendingMessageLimitStrategy">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">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<beans>
+</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">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<broker...>
+ <destinationPolicy>
+ <policyMap>
+ <policyEntries>
+ <policyEntry queue="QueueWhereItIsOkToExpireDLQEntries">
+ <deadLetterStrategy>
+ <.... expiration="300000" />
+ </deadLetterStrategy>
+ </policyEntry>
+ </policyEntries>
+ </policyMap>
+ </destinationPolicy>
+...
+</broker>
+]]></script>
+</div></div><h3
id="MessageRedeliveryandDLQHandling-TheDiscardingDLQPlugin">The Discarding DLQ
Plugin</h3><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#SlowConsumerHandling-ConstantPendingMessageLimitStrategy">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">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<beans>
<broker ...>
<plugins>
<discardingDLQBrokerPlugin dropAll="true"
dropTemporaryTopics="true" dropTemporaryQueues="true" />
@@ -204,13 +179,8 @@ policy.setMaximumRedeliveries(2);
</broker>
</beans>
]]></script>
-</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">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<beans>
+</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">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<beans>
<broker ...>
<plugins>
<discardingDLQBrokerPlugin dropOnly="MY.EXAMPLE.TOPIC.29
MY.EXAMPLE.QUEUE.87" reportInterval="1000" />
@@ -218,16 +188,8 @@ policy.setMaximumRedeliveries(2);
</broker>
</beans>
]]></script>
-</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">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<beans>
+</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">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<beans>
<broker ...>
<plugins>
<discardingDLQBrokerPlugin dropOnly="MY.EXAMPLE.TOPIC.[0-9]{3}
MY.EXAMPLE.QUEUE.[0-9]{3}" reportInterval="3000" />
@@ -235,22 +197,8 @@ policy.setMaximumRedeliveries(2);
</broker>
</beans>
]]></script>
-</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 unaware 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">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<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 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">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<broker
xmlns="http://activemq.apache.org/schema/core"
schedulerSupport="true" >
....
<plugins>
<redeliveryPlugin fallbackToDeadLetter="true"
sendToDlqIfMaxRetriesExceeded="true">
@@ -271,16 +219,7 @@ redeliveryDelay="10000" />
</redeliveryPlugin>
</plugins>
]]></script>
-</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>
+</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>
</td>
<td valign="top">
<div class="navigation">