Trying out "when" now. We can check with statusCode:500 etc in simple then. 
Thanks for your response.

Thanks and Regards,

Vanshul Chawla

-----Original Message-----
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Monday, May 04, 2015 5:38 PM
To: users@camel.apache.org
Subject: Re: Camel onException for different HTTP error codes

Hi

You can use onWhen to an exception as the predicate to trigger or not.
Then you can use some java code as the predicate to check for those http 
headers and figure out what to do.

There is also a retryWhile you can use etc.

Camel in Action book chapter 5, in the end of this chapter documents this. And 
you can find some bits on the Camel web site too.

On Mon, May 4, 2015 at 1:56 PM, Vanshul.Chawla <vanshul.cha...@target.com> 
wrote:
> We have a requirement wherein we need to do different error handling for 
> different error code returned from http external service.
>
> So we have to go for a retry for
>
> "X-Original-HTTP-Status-Code"=404,405,500,401
>
> And no retry for other codes.
>
> What I have learnt so far is onException will do selective handling but that 
> limits to a class only. And here class will be same.
>
> Other option I thought of is setting throwExceptionOnFailure but here I lose 
> the exception and it behaves like a handled response.
>
>
> Can anyone suggest me with an example on how this can be done in Camel Spring 
> DSL?
>
> Thanks and Regards,
>
> Vanshul Chawla
>



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Reply via email to