camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gnanda1 <gitanjali1_na...@hotmail.com>
Subject Dynamically setting retry count in maximumRedilveries attribute
Date Tue, 22 Jun 2010 21:47:08 GMT

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 

-- 
View this message in context: http://camel.465427.n5.nabble.com/Dynamically-setting-retry-count-in-maximumRedilveries-attribute-tp510764p510764.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message