camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <>
Subject Re: fault message on exception in CXF route
Date Fri, 18 Apr 2008 11:50:06 GMT
Hi Aswin,

I am happy to see Camel can be a central component of your new services 

It is better to put this thread into the public, in this way we can get 
more feed back  :). So I send this mail to the camel user list.

For you case if you want the cxf consumer return the exception back to 
the client, you have to put the exception into the exchange as the fault 
message. I had do some work on the JIRA[1] which may relate to your case.
You can find the simple unit test[2] here.

I don't know if we could leverage the block DSL to let the exception be 
caught in a certain block, then you set the out message in the exchange 
for the CXF consumer sending back to the client.

Maybe James can give us more ideals about the exception handling :)



Aswin Nair wrote:
> Hello Willem,
>       Congrats on the Camel 3 Release. We are using it for our new 
> services platform as the main central component along with CXF and I 
> am excited. 
> I have one question to ask on the Exception handling with regards to 
> CXF endpoints.  I have multiple processors that do various things and 
> on an exception I want to invoke a specific fault handler processor. 
> This processor is responsible for Exception to Message code 
> transalations and logging and stuff like that and would create a 
> response XML message. This message would be send back to the 
> requesting clients (web service response and not soap fault).
> I have routes defined as
>     exception(Throwable.class). 
> maximumRedeliveries(0).inheritErrorHandler(true)
>         .process(COMMON_ERROR_PROCESSOR)
>         .to("direct:FAULT_HANDLER");
>     from("cxf:bean:idiSOAP12EndPoint")       
>     .process("a")
>     .proces('b")
>     .....
>      ......
>     .process("finalDataAssemblerProcessor");
> So typically the exit points shoudl be finalDataAssembler or the 
> FaultHandler. But right now the response from Fault Handler does not 
> gets send back as the CamelInvoker checks for the failure and throws a 
> Fault ignoring my message. I tried getting around with a processor 
> that looks like following
> Exception exception = exchange.getProperty(
> "org.apache.camel.processor.DeadLetterChannel.FAILURE_HANDLED", 
> Exception.class);
> //do some with exception
> exchange.setProperty("org.apache.camel.processor.DeadLetterChannel.FAILURE_HANDLED",

> null);
> But this is causing the failed route to continue processing , which I 
> dodnt want. I just want the exception handling route to work ad create 
> a message which would get sent back to client.
> Any ideas on this regard would be deeply appreciated. I would create 
> an Nabble entry on this if you want me to. Thanks in advance
> -- 
> Aswin Nair

View raw message