Hi,
I just checked camel code, current camel doesn't support to set the
maximumRedliveries dynamically.
But I think you can set the retryUtil predicate to override it.
onException(xxx).onWhen(xxx).retryUntil(MyPredicate).to("xxxx").end();
You could write a custom predicate to check the if the the header value
of Exchange.REDELIVERY_COUNTER is great then the value of your
"EXCEPTION_RETRY_TIMES".
Willem
----------------------------------
Apache Camel, Apache CXF committer
Open SOA http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang
gnanda1 wrote:
I tried posting this message earlier and still in "Pending" list. Trying
again by reposting it..
Hi All,
I am using camel 2.2 with servicemix 4.2
I have a exception block that catches HttpOperationFailedException.class ,
parse the soap fault message.
Depending on the soap fault code I set the recipient for the exception
route. I would also like to set the maximumdelivery count dynamically based
on the soap fault code. I have exception block as below
onException(HttpOperationFailedException.class).onWhen(
new ExceptionFilterPredicate(this.inputQ,
this.errorQ,
this.retryQ)).useExponentialBackOff().maximumRedeliveries(1)
.handled(true).recipientList(header(Constants.DYNAMIC_EXCEPTION_URI));
In my ExceptionFilterPredicate class I set a header as below
exchange.getIn().setHeader("EXCEPTION_RETRY_TIMES", retryTimes);
How would I access this header to set maximumRedeliveries?
I tried something as below
onException(HttpOperationFailedException.class).onWhen(
new ExceptionFilterPredicate(this.inputQ,
this.errorQ,
this.retryQ)).useExponentialBackOff().maximumRedeliveries(this.header(Constants.EXCEPTION_RETRY_TIMES).evaluate(exchange,
Integer.class))
.handled(true).recipientList(header(Constants.DYNAMIC_EXCEPTION_URI));
But exchange is not accessible. It has compilation error. Please suggest.
Thanks & Regards
Gnanda