You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by prabhuj <pr...@gmail.com> on 2016/10/04 13:46:58 UTC

camel-ahc response body after exception

I am getting AhcOperationFailedException while invoking http call using
camel-ahc component. How can i capture the response body of http call that
resulted in AhcOperationFailedException ?

My route

from("activemq:queue:MY_QUEUE")
        .process(this.processor1)
        .to("ahc:http://example.com/v1/hello")
        .process(this.processor2);



--
View this message in context: http://camel.465427.n5.nabble.com/camel-ahc-response-body-after-exception-tp5788350.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: camel-ahc response body after exception

Posted by "Siano, Stephan" <st...@sap.com>.
Hi,

There are different options to achieve this. You can either set the throwExceptionOnFailure option to false. Then you will have access to the response payload if the server sends one, but you might have to evaluate the HTTP response code by yourself.

Alternatively you can create an onException handler on the AhcOperationFailedException and call the getResponseBody method on that in order to get the response body.

Best regards
Stephan

-----Original Message-----
From: prabhuj [mailto:prabhu.undefined@gmail.com] 
Sent: Dienstag, 4. Oktober 2016 15:47
To: users@camel.apache.org
Subject: camel-ahc response body after exception

I am getting AhcOperationFailedException while invoking http call using
camel-ahc component. How can i capture the response body of http call that
resulted in AhcOperationFailedException ?

My route

from("activemq:queue:MY_QUEUE")
        .process(this.processor1)
        .to("ahc:http://example.com/v1/hello")
        .process(this.processor2);



--
View this message in context: http://camel.465427.n5.nabble.com/camel-ahc-response-body-after-exception-tp5788350.html
Sent from the Camel - Users mailing list archive at Nabble.com.