On Tue, Jun 14, 2011 at 5:08 PM, Morten Holm <m...@tradeshift.com> wrote:
> Hi
>
> Redelivery is not disabled when maximumRedeliveries is set to 0. I experience 
> that one redelivery is always attempted.
>
> The errorhandler  looks like this.
>
>        <errorHandler xmlns="http://camel.apache.org/schema/spring"; 
> id="failedMessagesErrorHandler"
>                type="DeadLetterChannel" deadLetterUri="jms:deadLetters" 
> useOriginalMessage="true">
>                <redeliveryPolicy maximumRedeliveries="0"/>
>        </errorHandler>
>
>

You can enable logging for redelivery (retry) and set a high logging
level like WARN etc. so you can notice it in the logs.

<xs:attribute name="retryAttemptedLogLevel" type="tns:loggingLevel"/>
<xs:attribute name="logRetryAttempted" type="xs:string"/>

But using 0 ought not to attempt redeliveries, unless you have
<onException> or something else that has a policy which overrides the
<errorHandler>.


> It seems like the last line could be the problem:
>
> From RedeliveryPolicy.java:
>   /**
>    * Returns true if the policy decides that the message exchange should be
>    * redelivered.
>    *
>    * @param exchange  the current exchange
>    * @param redeliveryCounter  the current retry counter
>    * @param retryWhile  an optional predicate to determine if we should 
> redeliver or not
>    * @return true to redeliver, false to stop
>    */
>   public boolean shouldRedeliver(Exchange exchange, int redeliveryCounter, 
> Predicate retryWhile) {
>       // predicate is always used if provided
>       if (retryWhile != null) {
>           return retryWhile.matches(exchange);
>       }
>
>       if (getMaximumRedeliveries() < 0) {
>           // retry forever if negative value
>           return true;
>       }
>       // redeliver until we hit the max
>       return redeliveryCounter <= getMaximumRedeliveries();
>   }
>
> Am I doing something wrong ? Are there some properties that I have to set ?
>
> -- camel version: 2.7.1
>
> --
> Morten Holm
> Developer
>
> Voice: +45 31 18 91 08
> Skype: morten.holm
>
> http://tradeshift.com - INVOICING HAS NEVER BEEN EASIER
>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to