camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r936649 [2/3] - in /websites/production/camel/content: book-in-one-page.html book-pattern-appendix.html cache/main.pageCache dead-letter-channel.html
Date Sun, 18 Jan 2015 16:18:44 GMT
Modified: websites/production/camel/content/book-pattern-appendix.html
==============================================================================
--- websites/production/camel/content/book-pattern-appendix.html (original)
+++ websites/production/camel/content/book-pattern-appendix.html Sun Jan 18 16:18:44 2015
@@ -448,58 +448,19 @@ RouteBuilder builder = new RouteBuilder(
 <h4 id="BookPatternAppendix-UsingThisPattern.7">Using This Pattern</h4>
 
 <p>If you would like to use this EIP Pattern then please read the <a shape="rect" href="getting-started.html">Getting Started</a>, you may also find the <a shape="rect" href="architecture.html">Architecture</a> useful particularly the description of <a shape="rect" href="endpoint.html">Endpoint</a> and <a shape="rect" href="uris.html">URIs</a>. Then you could try out some of the <a shape="rect" href="examples.html">Examples</a> first before trying this pattern out.</p>
-<h2 id="BookPatternAppendix-DeadLetterChannel">Dead Letter Channel</h2>
-
-<p>Camel supports the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/DeadLetterChannel.html" rel="nofollow">Dead Letter Channel</a> from the <a shape="rect" href="enterprise-integration-patterns.html">EIP patterns</a> using the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/DeadLetterChannel.html">DeadLetterChannel</a> processor which is an <a shape="rect" href="error-handler.html">Error Handler</a>. </p>
-
-<p><img class="confluence-embedded-image confluence-external-resource" src="http://www.enterpriseintegrationpatterns.com/img/DeadLetterChannelSolution.gif" data-image-src="http://www.enterpriseintegrationpatterns.com/img/DeadLetterChannelSolution.gif"></p>
-
-    <div class="aui-message success shadowed information-macro">
+<h2 id="BookPatternAppendix-DeadLetterChannel">Dead Letter Channel</h2><p>Camel supports the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/DeadLetterChannel.html" rel="nofollow">Dead Letter Channel</a> from the <a shape="rect" href="enterprise-integration-patterns.html">EIP patterns</a> using the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/DeadLetterChannel.html">DeadLetterChannel</a> processor which is an <a shape="rect" href="error-handler.html">Error Handler</a>.</p><p><img class="confluence-embedded-image confluence-external-resource" src="http://www.enterpriseintegrationpatterns.com/img/DeadLetterChannelSolution.gif" data-image-src="http://www.enterpriseintegrationpatterns.com/img/DeadLetterChannelSolution.gif"></p>    <div class="aui-message success shadowed information-macro">
                     <p class="title">Difference between Dead Letter Channel and Default Error Handler</p>
                             <span class="aui-icon icon-success">Icon</span>
                 <div class="message-content">
-                            
-<p>The major difference is that <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> has a dead letter queue that whenever an <a shape="rect" href="exchange.html">Exchange</a> could not be processed is moved to. It will <strong>always</strong> move failed exchanges to this queue. </p>
-
-<p>Unlike the <a shape="rect" href="defaulterrorhandler.html">Default Error Handler</a> that does <strong>not</strong> have a dead letter queue. So whenever an <a shape="rect" href="exchange.html">Exchange</a> could not be processed the error is propagated back to the client.</p>
-
-<p><strong>Notice:</strong> You can adjust this behavior of whether the client should be notified or not with the <strong>handled</strong> option.</p>
+                            <p>The major difference is that <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> has a dead letter queue that whenever an <a shape="rect" href="exchange.html">Exchange</a> could not be processed is moved to. It will <strong>always</strong> move failed exchanges to this queue.</p><p>Unlike the <a shape="rect" href="defaulterrorhandler.html">Default Error Handler</a> that does <strong>not</strong> have a dead letter queue. So whenever an <a shape="rect" href="exchange.html">Exchange</a> could not be processed the error is propagated back to the client.</p><p><strong>Notice:</strong> You can adjust this behavior of whether the client should be notified or not with the <strong>handled</strong> option.</p><p>When the DeadLetterChannel moves a message to the dead letter endpoint, then if any new exceptions is thrown during that process, then by default the dead letter channel will handle the new exception as well. This ensures that the De
 adLetterChannel will always succeed. From <strong>Camel 2.15</strong> onwards this behavior can be changed by setting the option deadLetterHandleNewException=false. Then if a new exception is thrown, then the dead letter channel will fail and propagate back that new exception (which is the behavior of the default error handler). When a new exception occurs then the dead letter channel logs this at WARN level. This can be turned off by setting logNewException=false.</p>
                     </div>
     </div>
-
-
-<h3 id="BookPatternAppendix-Redelivery">Redelivery </h3>
-
-<p>It is common for a temporary outage or database deadlock to cause a message to fail to process; but the chances are if its tried a few more times with some time delay then it will complete fine. So we typically wish to use some kind of redelivery policy to decide how many times to try redeliver a message and how long to wait before redelivery attempts.</p>
-
-<p>The <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/RedeliveryPolicy.html">RedeliveryPolicy</a> defines how the message is to be redelivered. You can customize things like</p>
-
-<ul><li>how many times a message is attempted to be redelivered before it is considered a failure and sent to the dead letter channel</li><li>the initial redelivery timeout</li><li>whether or not exponential backoff is used (i.e. the time between retries increases using a backoff multiplier)</li><li>whether to use collision avoidance to add some randomness to the timings</li><li>delay pattern (see below for details)</li><li><strong>Camel 2.11:</strong> whether to allow redelivery during stopping/shutdown</li></ul>
-
-
-<p>Once all attempts at redelivering the message fails then the message is forwarded to the dead letter queue.</p>
-
-<h3 id="BookPatternAppendix-AboutmovingExchangetodeadletterqueueandusinghandled">About moving Exchange to dead letter queue and using handled</h3>
-<p><strong>Handled</strong> on <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a></p>
-
-<p>When all attempts of redelivery have failed the <a shape="rect" href="exchange.html">Exchange</a> is moved to the dead letter queue (the dead letter endpoint). The exchange is then complete and from the client point of view it was processed. As such the <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> have handled the <a shape="rect" href="exchange.html">Exchange</a>. </p>
-
-<p>For instance configuring the dead letter channel as:</p>
-
-<p><strong>Using the <a shape="rect" href="fluent-builders.html">Fluent Builders</a></strong></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[
-errorHandler(deadLetterChannel(&quot;jms:queue:dead&quot;)
+<h3 id="BookPatternAppendix-Redelivery">Redelivery</h3><p>It is common for a temporary outage or database deadlock to cause a message to fail to process; but the chances are if its tried a few more times with some time delay then it will complete fine. So we typically wish to use some kind of redelivery policy to decide how many times to try redeliver a message and how long to wait before redelivery attempts.</p><p>The <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/RedeliveryPolicy.html">RedeliveryPolicy</a> defines how the message is to be redelivered. You can customize things like</p><ul><li>how many times a message is attempted to be redelivered before it is considered a failure and sent to the dead letter channel</li><li>the initial redelivery timeout</li><li>whether or not exponential backoff is used (i.e. the time between retries increases using a backoff multiplier)</li><li>whether to use collisi
 on avoidance to add some randomness to the timings</li><li>delay pattern (see below for details)</li><li><strong>Camel 2.11:</strong> whether to allow redelivery during stopping/shutdown</li></ul><p>Once all attempts at redelivering the message fails then the message is forwarded to the dead letter queue.</p><h3 id="BookPatternAppendix-AboutmovingExchangetodeadletterqueueandusinghandled">About moving Exchange to dead letter queue and using handled</h3><p><strong>Handled</strong> on <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a></p><p>When all attempts of redelivery have failed the <a shape="rect" href="exchange.html">Exchange</a> is moved to the dead letter queue (the dead letter endpoint). The exchange is then complete and from the client point of view it was processed. As such the <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> have handled the <a shape="rect" href="exchange.html">Exchange</a>.</p><p>For instance configuring the dea
 d letter channel as:</p><p><strong>Using the <a shape="rect" href="fluent-builders.html">Fluent Builders</a></strong></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[errorHandler(deadLetterChannel(&quot;jms:queue:dead&quot;)
     .maximumRedeliveries(3).redeliveryDelay(5000));
 ]]></script>
-</div></div>
-
-<p><strong>Using the <a shape="rect" href="spring-xml-extensions.html">Spring XML Extensions</a></strong></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[
-&lt;route errorHandlerRef=&quot;myDeadLetterErrorHandler&quot;&gt;
+</div></div><p><strong>Using the <a shape="rect" href="spring-xml-extensions.html">Spring XML Extensions</a></strong></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[&lt;route errorHandlerRef=&quot;myDeadLetterErrorHandler&quot;&gt;
    ...
 &lt;/route&gt;
 
@@ -514,169 +475,39 @@ errorHandler(deadLetterChannel(&quot;jms
 &lt;/bean&gt;
 
 ]]></script>
-</div></div>
-
-<p>The <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> above will clear the caused exception (<code>setException(null)</code>), by moving the caused exception to a property on the <a shape="rect" href="exchange.html">Exchange</a>, with the key <code>Exchange.EXCEPTION_CAUGHT</code>. Then the <a shape="rect" href="exchange.html">Exchange</a> is moved to the <code>"jms:queue:dead"</code> destination and the client will not notice the failure. </p>
-
-<h3 id="BookPatternAppendix-AboutmovingExchangetodeadletterqueueandusingtheoriginalmessage">About moving Exchange to dead letter queue and using the original message</h3>
-<p>The option <strong>useOriginalMessage</strong> is used for routing the original input message instead of the current message that potentially is modified during routing.</p>
-
-<p>For instance if you have this route:</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[
-   from(&quot;jms:queue:order:input&quot;)
+</div></div><p>The <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> above will clear the caused exception (<code>setException(null)</code>), by moving the caused exception to a property on the <a shape="rect" href="exchange.html">Exchange</a>, with the key <code>Exchange.EXCEPTION_CAUGHT</code>. Then the <a shape="rect" href="exchange.html">Exchange</a> is moved to the <code>"jms:queue:dead"</code> destination and the client will not notice the failure.</p><h3 id="BookPatternAppendix-AboutmovingExchangetodeadletterqueueandusingtheoriginalmessage">About moving Exchange to dead letter queue and using the original message</h3><p>The option <strong>useOriginalMessage</strong> is used for routing the original input message instead of the current message that potentially is modified during routing.</p><p>For instance if you have this route:</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[   from(&quot;jms:queue:order:input&quot;)
        .to(&quot;bean:validateOrder&quot;)
        .to(&quot;bean:transformOrder&quot;)
        .to(&quot;bean:handleOrder&quot;);
 ]]></script>
-</div></div>
-<p>The route listen for JMS messages and validates, transforms and handle it. During this the <a shape="rect" href="exchange.html">Exchange</a> payload is transformed/modified. So in case something goes wrong and we want to move the message to another JMS destination, then we can configure our <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> with the <strong>useOriginalMessage</strong> option. But when we move the <a shape="rect" href="exchange.html">Exchange</a> to this destination we do not know in which state the message is in. Did the error happen in before the transformOrder or after? So to be sure we want to move the original input message we received from <code>jms:queue:order:input</code>. So we can do this by enabling the <strong>useOriginalMessage</strong> option as shown below:</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[
-    // will use original body
+</div></div><p>The route listen for JMS messages and validates, transforms and handle it. During this the <a shape="rect" href="exchange.html">Exchange</a> payload is transformed/modified. So in case something goes wrong and we want to move the message to another JMS destination, then we can configure our <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> with the <strong>useOriginalMessage</strong> option. But when we move the <a shape="rect" href="exchange.html">Exchange</a> to this destination we do not know in which state the message is in. Did the error happen in before the transformOrder or after? So to be sure we want to move the original input message we received from <code>jms:queue:order:input</code>. So we can do this by enabling the <strong>useOriginalMessage</strong> option as shown below:</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[    // will use original body
     errorHandler(deadLetterChannel(&quot;jms:queue:dead&quot;)
        .useOriginalMessage().mamimumRedeliveries(5).redeliverDelay(5000);
 ]]></script>
-</div></div>
-
-<p>Then the messages routed to the <code>jms:queue:dead</code> is the original input. If we want to manually retry we can move the JMS message from the failed to the input queue, with no problem as the message is the same as the original we received.</p>
-
-
-<h3 id="BookPatternAppendix-OnRedelivery">OnRedelivery</h3>
-
-<p>When <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> is doing redeliver its possible to configure a <a shape="rect" href="processor.html">Processor</a> that is executed just <strong>before</strong> every redelivery attempt. This can be used for the situations where you need to alter the message before its redelivered. See below for sample. </p>
-
-    <div class="aui-message success shadowed information-macro">
+</div></div><p>Then the messages routed to the <code>jms:queue:dead</code> is the original input. If we want to manually retry we can move the JMS message from the failed to the input queue, with no problem as the message is the same as the original we received.</p><h3 id="BookPatternAppendix-OnRedelivery">OnRedelivery</h3><p>When <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> is doing redeliver its possible to configure a <a shape="rect" href="processor.html">Processor</a> that is executed just <strong>before</strong> every redelivery attempt. This can be used for the situations where you need to alter the message before its redelivered. See below for sample.</p>    <div class="aui-message success shadowed information-macro">
                     <p class="title">onException and onRedeliver</p>
                             <span class="aui-icon icon-success">Icon</span>
                 <div class="message-content">
-                            
-<p>We also support for per <a shape="rect" href="exception-clause.html"><strong>onException</strong></a> to set a <strong>onRedeliver</strong>. That means you can do special on redelivery for different exceptions, as opposed to onRedelivery set on <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> can be viewed as a global scope.</p>
+                            <p>We also support for per <a shape="rect" href="exception-clause.html"><strong>onException</strong></a> to set a <strong>onRedeliver</strong>. That means you can do special on redelivery for different exceptions, as opposed to onRedelivery set on <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> can be viewed as a global scope.</p>
                     </div>
     </div>
-
-
-
-<h3 id="BookPatternAppendix-Redeliverydefaultvalues">Redelivery default values</h3>
-<p>Redelivery is disabled by default.</p>
-
-<p>The default redeliver policy will use the following values:</p>
-<ul><li>maximumRedeliveries=0</li><li>redeliverDelay=1000L (1 second)</li><li>maximumRedeliveryDelay = 60 * 1000L (60 seconds)</li><li>And the exponential backoff and collision avoidance is turned off.</li><li>The retriesExhaustedLogLevel are set to LoggingLevel.ERROR</li><li>The retryAttemptedLogLevel are set to LoggingLevel.DEBUG</li><li>Stack traces is logged for exhausted messages from Camel 2.2 onwards.</li><li>Handled exceptions is not logged from Camel 2.3 onwards</li></ul>
-
-
-<p>The maximum redeliver delay ensures that a delay is never longer than the value, default 1 minute. This can happen if you turn on the exponential backoff.</p>
-
-<p>The maximum redeliveries is the number of <strong>re</strong> delivery attempts. By default Camel will try to process the exchange 1 + 5 times. 1 time for the normal attempt and then 5 attempts as redeliveries.<br clear="none">
-Setting the maximumRedeliveries to a negative value such as -1 will then always redelivery (unlimited).<br clear="none">
-Setting the maximumRedeliveries to 0 will disable any re delivery attempt.</p>
-
-<p>Camel will log delivery failures at the DEBUG logging level by default. You can change this by specifying retriesExhaustedLogLevel and/or retryAttemptedLogLevel. See <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderWithRetryLoggingLevelSetTest.java">ExceptionBuilderWithRetryLoggingLevelSetTest</a> for an example. </p>
-
-<p>You can turn logging of stack traces on/off. If turned off Camel will still log the redelivery attempt. Its just much less verbose.</p>
-
-<h4 id="BookPatternAppendix-RedeliverDelayPattern">Redeliver Delay Pattern</h4>
-<p>Delay pattern is used as a single option to set a range pattern for delays. If used then the following options does not apply: (delay, backOffMultiplier, useExponentialBackOff, useCollisionAvoidance, maximumRedeliveryDelay).</p>
-
-<p>The idea is to set groups of ranges using the following syntax: <code>limit:delay;limit 2:delay 2;limit 3:delay 3;...;limit N:delay N</code></p>
-
-<p>Each group has two values separated with colon</p>
-<ul class="alternate"><li>limit = upper limit</li><li>delay = delay in millis<br clear="none">
-And the groups is again separated with semi colon.<br clear="none">
-The rule of thumb is that the next groups should have a higher limit than the previous group.</li></ul>
-
-
-<p>Lets clarify this with an example:<br clear="none">
-<code>delayPattern=5:1000;10:5000;20:20000</code></p>
-
-<p>That gives us 3 groups:</p>
-<ul class="alternate"><li>5:1000</li><li>10:5000</li><li>20:20000</li></ul>
-
-
-<p>Resulting in these delays for redelivery attempt:</p>
-<ul class="alternate"><li>Redelivery attempt number 1..4 = 0 millis (as the first group start with 5)</li><li>Redelivery attempt number 5..9 = 1000 millis (the first group)</li><li>Redelivery attempt number 10..19 = 5000 millis (the second group)</li><li>Redelivery attempt number 20.. = 20000 millis (the last group)</li></ul>
-
-
-<p>Note: The first redelivery attempt is 1, so the first group should start with 1 or higher.</p>
-
-<p>You can start a group with limit 1 to eg have a starting delay: <code>delayPattern=1:1000;5:5000</code></p>
-<ul class="alternate"><li>Redelivery attempt number 1..4 = 1000 millis (the first group)</li><li>Redelivery attempt number 5.. = 5000 millis (the last group)</li></ul>
-
-
-<p>There is no requirement that the next delay should be higher than the previous. You can use any delay value you like. For example with <code>delayPattern=1:5000;3:1000</code> we start with 5 sec delay and then later reduce that to 1 second.</p>
-
-<h3 id="BookPatternAppendix-Redeliveryheader">Redelivery header</h3>
-
-<p>When a message is redelivered the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/camel-core/apidocs/org/apache/camel/processor/DeadLetterChannel.html">DeadLetterChannel</a> will append a customizable header to the message to indicate how many times its been redelivered. <br clear="none">
-Before Camel 2.6: The header is <strong>CamelRedeliveryCounter</strong>, which is also defined on the <code>Exchange.REDELIVERY_COUNTER</code>.<br clear="none">
-Starting with 2.6: The header <strong>CamelRedeliveryMaxCounter</strong>, which is also defined on the <code>Exchange.REDELIVERY_MAX_COUNTER</code>, contains the maximum redelivery setting. This header is absent if you use <code>retryWhile</code> or have unlimited maximum redelivery configured.</p>
-
-<p>And a boolean flag whether it is being redelivered or not (first attempt)<br clear="none">
-The header <strong>CamelRedelivered</strong> contains a boolean if the message is redelivered or not, which is also defined on the <code>Exchange.REDELIVERED</code>.</p>
-
-<p>Dynamically calculated delay from the exchange<br clear="none">
-In Camel 2.9 and 2.8.2: The header is <strong>CamelRedeliveryDelay</strong>, which is also defined on the <code>Exchange.REDELIVERY_DELAY</code>.<br clear="none">
-Is this header is absent, normal redelivery rules apply.</p>
-
-<h4 id="BookPatternAppendix-Whichendpointfailed">Which endpoint failed</h4>
-<p><strong>Available as of Camel 2.1</strong></p>
-
-<p>When Camel routes messages it will decorate the <a shape="rect" href="exchange.html">Exchange</a> with a property that contains the <strong>last</strong> endpoint Camel send the <a shape="rect" href="exchange.html">Exchange</a> to:</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[
-String lastEndpointUri = exchange.getProperty(Exchange.TO_ENDPOINT, String.class);
+<h3 id="BookPatternAppendix-Redeliverydefaultvalues">Redelivery default values</h3><p>Redelivery is disabled by default.</p><p>The default redeliver policy will use the following values:</p><ul><li>maximumRedeliveries=0</li><li>redeliverDelay=1000L (1 second)</li><li>maximumRedeliveryDelay = 60 * 1000L (60 seconds)</li><li>And the exponential backoff and collision avoidance is turned off.</li><li>The retriesExhaustedLogLevel are set to LoggingLevel.ERROR</li><li>The retryAttemptedLogLevel are set to LoggingLevel.DEBUG</li><li>Stack traces is logged for exhausted messages from Camel 2.2 onwards.</li><li>Handled exceptions is not logged from Camel 2.3 onwards</li></ul><p>The maximum redeliver delay ensures that a delay is never longer than the value, default 1 minute. This can happen if you turn on the exponential backoff.</p><p>The maximum redeliveries is the number of <strong>re</strong> delivery attempts. By default Camel will try to process the exchange 1 + 5 times. 1 time for the
  normal attempt and then 5 attempts as redeliveries.<br clear="none"> Setting the maximumRedeliveries to a negative value such as -1 will then always redelivery (unlimited).<br clear="none"> Setting the maximumRedeliveries to 0 will disable any re delivery attempt.</p><p>Camel will log delivery failures at the DEBUG logging level by default. You can change this by specifying retriesExhaustedLogLevel and/or retryAttemptedLogLevel. See <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderWithRetryLoggingLevelSetTest.java">ExceptionBuilderWithRetryLoggingLevelSetTest</a> for an example.</p><p>You can turn logging of stack traces on/off. If turned off Camel will still log the redelivery attempt. Its just much less verbose.</p><h4 id="BookPatternAppendix-RedeliverDelayPattern">Redeliver Delay Pattern</h4><p>Delay pattern is used as a single option to set a range pattern for delays. If use
 d then the following options does not apply: (delay, backOffMultiplier, useExponentialBackOff, useCollisionAvoidance, maximumRedeliveryDelay).</p><p>The idea is to set groups of ranges using the following syntax: <code>limit:delay;limit 2:delay 2;limit 3:delay 3;...;limit N:delay N</code></p><p>Each group has two values separated with colon</p><ul class="alternate"><li>limit = upper limit</li><li>delay = delay in millis<br clear="none"> And the groups is again separated with semi colon.<br clear="none"> The rule of thumb is that the next groups should have a higher limit than the previous group.</li></ul><p>Lets clarify this with an example:<br clear="none"> <code>delayPattern=5:1000;10:5000;20:20000</code></p><p>That gives us 3 groups:</p><ul class="alternate"><li>5:1000</li><li>10:5000</li><li>20:20000</li></ul><p>Resulting in these delays for redelivery attempt:</p><ul class="alternate"><li>Redelivery attempt number 1..4 = 0 millis (as the first group start with 5)</li><li>Redeli
 very attempt number 5..9 = 1000 millis (the first group)</li><li>Redelivery attempt number 10..19 = 5000 millis (the second group)</li><li>Redelivery attempt number 20.. = 20000 millis (the last group)</li></ul><p>Note: The first redelivery attempt is 1, so the first group should start with 1 or higher.</p><p>You can start a group with limit 1 to eg have a starting delay: <code>delayPattern=1:1000;5:5000</code></p><ul class="alternate"><li>Redelivery attempt number 1..4 = 1000 millis (the first group)</li><li>Redelivery attempt number 5.. = 5000 millis (the last group)</li></ul><p>There is no requirement that the next delay should be higher than the previous. You can use any delay value you like. For example with <code>delayPattern=1:5000;3:1000</code> we start with 5 sec delay and then later reduce that to 1 second.</p><h3 id="BookPatternAppendix-Redeliveryheader">Redelivery header</h3><p>When a message is redelivered the <a shape="rect" class="external-link" href="http://camel.apa
 che.org/maven/camel-core/apidocs/org/apache/camel/processor/DeadLetterChannel.html">DeadLetterChannel</a> will append a customizable header to the message to indicate how many times its been redelivered. <br clear="none"> Before Camel 2.6: The header is <strong>CamelRedeliveryCounter</strong>, which is also defined on the <code>Exchange.REDELIVERY_COUNTER</code>.<br clear="none"> Starting with 2.6: The header <strong>CamelRedeliveryMaxCounter</strong>, which is also defined on the <code>Exchange.REDELIVERY_MAX_COUNTER</code>, contains the maximum redelivery setting. This header is absent if you use <code>retryWhile</code> or have unlimited maximum redelivery configured.</p><p>And a boolean flag whether it is being redelivered or not (first attempt)<br clear="none"> The header <strong>CamelRedelivered</strong> contains a boolean if the message is redelivered or not, which is also defined on the <code>Exchange.REDELIVERED</code>.</p><p>Dynamically calculated delay from the exchange<br
  clear="none"> In Camel 2.9 and 2.8.2: The header is <strong>CamelRedeliveryDelay</strong>, which is also defined on the <code>Exchange.REDELIVERY_DELAY</code>.<br clear="none"> Is this header is absent, normal redelivery rules apply.</p><h4 id="BookPatternAppendix-Whichendpointfailed">Which endpoint failed</h4><p><strong>Available as of Camel 2.1</strong></p><p>When Camel routes messages it will decorate the <a shape="rect" href="exchange.html">Exchange</a> with a property that contains the <strong>last</strong> endpoint Camel send the <a shape="rect" href="exchange.html">Exchange</a> to:</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[String lastEndpointUri = exchange.getProperty(Exchange.TO_ENDPOINT, String.class);
 ]]></script>
-</div></div>
-<p>The <code>Exchange.TO_ENDPOINT</code> have the constant value <code>CamelToEndpoint</code>.</p>
-
-<p>This information is updated when Camel sends a message to any endpoint. So if it exists its the <strong>last</strong> endpoint which Camel send the Exchange to.</p>
-
-<p>When for example processing the <a shape="rect" href="exchange.html">Exchange</a> at a given <a shape="rect" href="endpoint.html">Endpoint</a> and the message is to be moved into the dead letter queue, then Camel also decorates the Exchange with another property that contains that <strong>last</strong> endpoint:</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[
-String failedEndpointUri = exchange.getProperty(Exchange.FAILURE_ENDPOINT, String.class);
+</div></div><p>The <code>Exchange.TO_ENDPOINT</code> have the constant value <code>CamelToEndpoint</code>.</p><p>This information is updated when Camel sends a message to any endpoint. So if it exists its the <strong>last</strong> endpoint which Camel send the Exchange to.</p><p>When for example processing the <a shape="rect" href="exchange.html">Exchange</a> at a given <a shape="rect" href="endpoint.html">Endpoint</a> and the message is to be moved into the dead letter queue, then Camel also decorates the Exchange with another property that contains that <strong>last</strong> endpoint:</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[String failedEndpointUri = exchange.getProperty(Exchange.FAILURE_ENDPOINT, String.class);
 ]]></script>
-</div></div>
-<p>The <code>Exchange.FAILURE_ENDPOINT</code> have the constant value <code>CamelFailureEndpoint</code>.</p>
-
-<p>This allows for example you to fetch this information in your dead letter queue and use that for error reporting.<br clear="none">
-This is useable if the Camel route is a bit dynamic such as the dynamic <a shape="rect" href="recipient-list.html">Recipient List</a> so you know which endpoints failed.</p>
-
-<p><strong>Notice:</strong> These information is kept on the Exchange even if the message was successfully processed by a given endpoint, and then later fails for example in a local <a shape="rect" href="bean.html">Bean</a> processing instead. So beware that this is a hint that helps pinpoint errors.</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[
-from(&quot;activemq:queue:foo&quot;)
+</div></div><p>The <code>Exchange.FAILURE_ENDPOINT</code> have the constant value <code>CamelFailureEndpoint</code>.</p><p>This allows for example you to fetch this information in your dead letter queue and use that for error reporting.<br clear="none"> This is useable if the Camel route is a bit dynamic such as the dynamic <a shape="rect" href="recipient-list.html">Recipient List</a> so you know which endpoints failed.</p><p><strong>Notice:</strong> These information is kept on the Exchange even if the message was successfully processed by a given endpoint, and then later fails for example in a local <a shape="rect" href="bean.html">Bean</a> processing instead. So beware that this is a hint that helps pinpoint errors.</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[from(&quot;activemq:queue:foo&quot;)
     .to(&quot;http://someserver/somepath&quot;)
     .beanRef(&quot;foo&quot;);
 ]]></script>
-</div></div>
-
-<p>Now suppose the route above and a failure happens in the <code>foo</code> bean. Then the <code>Exchange.TO_ENDPOINT</code> and <code>Exchange.FAILURE_ENDPOINT</code> will still contain the value of <code><a shape="rect" class="external-link" href="http://someserver/somepath" rel="nofollow">http://someserver/somepath</a></code>.</p>
-
-
-<h3 id="BookPatternAppendix-Whichroutefailed">Which route failed</h3>
-<p><strong>Available as of Camel 2.10.4/2.11</strong></p>
-
-<p>When Camel error handler handles an error such as <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> or using <a shape="rect" href="exception-clause.html">Exception Clause</a> with handled=true, then Camel will decorate<br clear="none">
-the <a shape="rect" href="exchange.html">Exchange</a> with the route id where the error occurred.</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[
-String failedRouteId = exchange.getProperty(Exchange.FAILURE_ROUTE_ID, String.class);
+</div></div><p>Now suppose the route above and a failure happens in the <code>foo</code> bean. Then the <code>Exchange.TO_ENDPOINT</code> and <code>Exchange.FAILURE_ENDPOINT</code> will still contain the value of <code><a shape="rect" class="external-link" href="http://someserver/somepath" rel="nofollow">http://someserver/somepath</a></code>.</p><h3 id="BookPatternAppendix-Whichroutefailed">Which route failed</h3><p><strong>Available as of Camel 2.10.4/2.11</strong></p><p>When Camel error handler handles an error such as <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> or using <a shape="rect" href="exception-clause.html">Exception Clause</a> with handled=true, then Camel will decorate<br clear="none"> the <a shape="rect" href="exchange.html">Exchange</a> with the route id where the error occurred.</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[String failedRouteId = exchange.getProperty(Exchange.FAILURE_ROUTE_ID, String.class);
 ]]></script>
-</div></div>
-<p>The <code>Exchange.FAILURE_ROUTE_ID</code> have the constant value <code>CamelFailureRouteId</code>.</p>
-
-<p>This allows for example you to fetch this information in your dead letter queue and use that for error reporting.</p>
-
-
-<h3 id="BookPatternAppendix-Controlifredeliveryisallowedduringstopping/shutdown">Control if redelivery is allowed during stopping/shutdown</h3>
-<p><strong>Available as of Camel 2.11</strong></p>
-
-<p>Prior to Camel 2.10, Camel will perform redelivery while stopping a route, or shutting down Camel. This has improved a bit in Camel 2.10 onwards, as Camel will not perform redelivery attempts when shutting down aggressively (eg during <a shape="rect" href="graceful-shutdown.html">Graceful Shutdown</a> and timeout hit). From Camel 2.11 onwards there is a new option <code>allowRedeliveryWhileStopping</code> which you can use to control if redelivery is allowed or not; notice that any in progress redelivery will still be executed. This option can only disallow any redelivery to be executed <strong>after</strong> the stopping of a route/shutdown of Camel has been triggered. If a redelivery is dissallowed then a <code>RejectedExcutionException</code> is set on the <a shape="rect" href="exchange.html">Exchange</a> and the processing of the <a shape="rect" href="exchange.html">Exchange</a> stops. This means any consumer will see the <a shape="rect" href="exchange.html">Exchange</a> as f
 ailed due the <code>RejectedExecutionException</code>.</p>
-
-<p>The default value is <code>true</code> to be backwards compatible as before. For example the following sample shows how to do this with Java DSL and XML DSL</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>The <code>Exchange.FAILURE_ROUTE_ID</code> have the constant value <code>CamelFailureRouteId</code>.</p><p>This allows for example you to fetch this information in your dead letter queue and use that for error reporting.</p><h3 id="BookPatternAppendix-Controlifredeliveryisallowedduringstopping/shutdown">Control if redelivery is allowed during stopping/shutdown</h3><p><strong>Available as of Camel 2.11</strong></p><p>Prior to Camel 2.10, Camel will perform redelivery while stopping a route, or shutting down Camel. This has improved a bit in Camel 2.10 onwards, as Camel will not perform redelivery attempts when shutting down aggressively (eg during <a shape="rect" href="graceful-shutdown.html">Graceful Shutdown</a> and timeout hit). From Camel 2.11 onwards there is a new option <code>allowRedeliveryWhileStopping</code> which you can use to control if redelivery is allowed or not; notice that any in progress redelivery will still be executed. This option can only disallo
 w any redelivery to be executed <strong>after</strong> the stopping of a route/shutdown of Camel has been triggered. If a redelivery is dissallowed then a <code>RejectedExcutionException</code> is set on the <a shape="rect" href="exchange.html">Exchange</a> and the processing of the <a shape="rect" href="exchange.html">Exchange</a> stops. This means any consumer will see the <a shape="rect" href="exchange.html">Exchange</a> as failed due the <code>RejectedExecutionException</code>.</p><p>The default value is <code>true</code> to be backwards compatible as before. For example the following sample shows how to do this with Java DSL and XML DSL</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[
 
 // this error handler will try up till 20 redelivery attempts with 1 second between.
@@ -689,10 +520,7 @@ from(&quot;seda:foo&quot;).routeId(&quot
     .to(&quot;mock:foo&quot;)
     .throwException(new IllegalArgumentException(&quot;Forced&quot;));
 ]]></script>
-</div></div>
-
-<p>And the sample sample with XML DSL</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>And the sample sample with XML DSL</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[
 &lt;!-- notice we use the errorHandlerRef attribute to refer to the error handler to use as default --&gt;
    &lt;camelContext errorHandlerRef=&quot;myErrorHandler&quot; xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
@@ -711,12 +539,7 @@ from(&quot;seda:foo&quot;).routeId(&quot
 
    &lt;/camelContext&gt;
 ]]></script>
-</div></div>
-
-
-<h3 id="BookPatternAppendix-Samples">Samples</h3>
-<p>The following example shows how to configure the Dead Letter Channel configuration using the <a shape="rect" href="dsl.html">DSL</a></p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="BookPatternAppendix-Samples">Samples</h3><p>The following example shows how to configure the Dead Letter Channel configuration using the <a shape="rect" href="dsl.html">DSL</a></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[
 RouteBuilder builder = new RouteBuilder() {
     public void configure() {
@@ -728,10 +551,7 @@ RouteBuilder builder = new RouteBuilder(
     }
 };
 ]]></script>
-</div></div>
-
-<p>You can also configure the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/RedeliveryPolicy.html">RedeliveryPolicy</a> as this example shows</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>You can also configure the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/RedeliveryPolicy.html">RedeliveryPolicy</a> as this example shows</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[
 RouteBuilder builder = new RouteBuilder() {
     public void configure() {
@@ -744,15 +564,7 @@ RouteBuilder builder = new RouteBuilder(
     }
 };
 ]]></script>
-</div></div>
-
-<h3 id="BookPatternAppendix-HowcanImodifytheExchangebeforeredelivery?">How can I modify the Exchange before redelivery?</h3>
-<p>We support directly in <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> to set a <a shape="rect" href="processor.html">Processor</a> that is executed <strong>before</strong> each redelivery attempt. </p>
-
-<p>When <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> is doing redeliver its possible to configure a <a shape="rect" href="processor.html">Processor</a> that is executed just <strong>before</strong> every redelivery attempt. This can be used for the situations where you need to alter the message before its redelivered.  </p>
-
-<p>Here we configure the <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> to use our processor <code>MyRedeliveryProcessor</code> to be executed before each redelivery.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="BookPatternAppendix-HowcanImodifytheExchangebeforeredelivery?">How can I modify the Exchange before redelivery?</h3><p>We support directly in <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> to set a <a shape="rect" href="processor.html">Processor</a> that is executed <strong>before</strong> each redelivery attempt.</p><p>When <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> is doing redeliver its possible to configure a <a shape="rect" href="processor.html">Processor</a> that is executed just <strong>before</strong> every redelivery attempt. This can be used for the situations where you need to alter the message before its redelivered.</p><p>Here we configure the <a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> to use our processor <code>MyRedeliveryProcessor</code> to be executed before each redelivery.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelCont
 ent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 // we configure our Dead Letter Channel to invoke
 // MyRedeliveryProcessor before a redelivery is
@@ -762,10 +574,7 @@ errorHandler(deadLetterChannel(&quot;moc
         // setting delay to zero is just to make unit testing faster
         .redeliveryDelay(0L));
 ]]></script>
-</div></div>
-
-<p>And this is the processor <code>MyRedeliveryProcessor</code> where we alter the message. </p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>And this is the processor <code>MyRedeliveryProcessor</code> where we alter the message.</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[
 // This is our processor that is executed before every redelivery attempt
 // here we can do what we want in the java code, such as altering the message
@@ -787,12 +596,9 @@ public class MyRedeliverProcessor implem
     }
 }
 ]]></script>
-</div></div>
+</div></div><p></p><h4 id="BookPatternAppendix-UsingThisPattern.8">Using This Pattern</h4>
 
-<h4 id="BookPatternAppendix-UsingThisPattern.8">Using This Pattern</h4>
-
-<p>If you would like to use this EIP Pattern then please read the <a shape="rect" href="getting-started.html">Getting Started</a>, you may also find the <a shape="rect" href="architecture.html">Architecture</a> useful particularly the description of <a shape="rect" href="endpoint.html">Endpoint</a> and <a shape="rect" href="uris.html">URIs</a>. Then you could try out some of the <a shape="rect" href="examples.html">Examples</a> first before trying this pattern out.</p>
-<ul class="alternate"><li><a shape="rect" href="error-handler.html">Error Handler</a></li><li><a shape="rect" href="exception-clause.html">Exception Clause</a></li></ul>
+<p>If you would like to use this EIP Pattern then please read the <a shape="rect" href="getting-started.html">Getting Started</a>, you may also find the <a shape="rect" href="architecture.html">Architecture</a> useful particularly the description of <a shape="rect" href="endpoint.html">Endpoint</a> and <a shape="rect" href="uris.html">URIs</a>. Then you could try out some of the <a shape="rect" href="examples.html">Examples</a> first before trying this pattern out.</p><ul class="alternate"><li><a shape="rect" href="error-handler.html">Error Handler</a></li><li><a shape="rect" href="exception-clause.html">Exception Clause</a></li></ul>
 <h3 id="BookPatternAppendix-GuaranteedDelivery">Guaranteed Delivery</h3><p>Camel supports the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/GuaranteedMessaging.html" rel="nofollow">Guaranteed Delivery</a> from the <a shape="rect" href="enterprise-integration-patterns.html">EIP patterns</a> using among others the following components:</p><ul><li><a shape="rect" href="file2.html">File</a> for using file systems as a persistent store of messages</li><li><a shape="rect" href="jms.html">JMS</a> when using persistent delivery (the default) for working with JMS Queues and Topics for high performance, clustering and load balancing</li><li><a shape="rect" href="jpa.html">JPA</a> for using a database as a persistence layer, or use any of the many other database component such as <a shape="rect" href="sql.html">SQL</a>, <a shape="rect" href="jdbc.html">JDBC</a>, <a shape="rect" href="ibatis.html">iBATIS</a>/<a shape="rect" href="mybatis.html">MyBatis<
 /a>, <a shape="rect" href="hibernate.html">Hibernate</a></li><li><a shape="rect" href="hawtdb.html">HawtDB</a> for a lightweight key-value persistent store</li></ul><p><img class="confluence-embedded-image confluence-external-resource" src="http://www.enterpriseintegrationpatterns.com/img/GuaranteedMessagingSolution.gif" data-image-src="http://www.enterpriseintegrationpatterns.com/img/GuaranteedMessagingSolution.gif"></p><h4 id="BookPatternAppendix-Example.1">Example</h4><p>The following example demonstrates illustrates the use of&#160;<a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/GuaranteedMessaging.html" rel="nofollow">Guaranteed Delivery</a>&#160;within the&#160;<a shape="rect" href="jms.html">JMS</a>&#160;component. By default, a message is not considered successfully delivered until the recipient has persisted the message locally guaranteeing its receipt in the event the destination becomes unavailable.</p><p><strong>Using the&#160;<a 
 shape="rect" href="fluent-builders.html">Fluent Builders</a></strong></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[from(&quot;direct:start&quot;)
 	.to(&quot;jms:queue:foo&quot;);]]></script>

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.



Mime
View raw message