Hi 

I have a onException block where i want to handle
org.apache.camel.component.cxf.CxfOperationException
but only when the status is 404. other status codes should fail and
rollback.

The route is ->
<route id="msub-allnews-out-Route">
        <from
uri="hubTopic:topic:CMS_CONTENT_HUB?clientId=NEWS&amp;durableSubscriptionName=NEWS"
/>
        <onException>
        
<exception>org.apache.camel.component.cxf.CxfOperationException</exception>
                   <onWhen>
                        <method beanType="xx.ss.sss.HttpExceptionInterpreter"/>
                </onWhen>
                <handled><constant>true</constant></handled>
        </onException>
        <transacted/>
        <do a whole lot of stuff and here>
        <inOut
uri="cxfrs:bean:allnews?synchronous=true&amp;throwExceptionOnFailure=true"/>
</route>

the HttpExceptionInterpreter is kind of simple ->
public static boolean is404(@ExchangeException CxfOperationException
exception) {
                return exception.getStatusCode() == 404;
        }

I would guess that I could avoid the bean, and that the http status code
would be set on the exchange header (in or out) so that i could use the
simple language to do something like <simple>out.header.xxxx == 404 in the
onWhen. 

Is that possible ? 

There is no http status code on the in.header btw.

I'm using Camel version 2.11.1

Best,
Preben




--
View this message in context: 
http://camel.465427.n5.nabble.com/Getting-http-status-code-from-cxfrs-in-onException-handler-tp5744066.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to