camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: CXF consumer: fault handling
Date Thu, 05 Aug 2010 07:47:36 GMT
On Thu, Aug 5, 2010 at 9:23 AM, S. Ali Tokmen <savas-ali.tokmen@bull.net> wrote:
> Hello
>
> On 05/08/2010 05:47, Willem Jiang wrote:
>>
>> CXF FaultOutInterceptor will take care of it if you just throw the Fault
>> message out from CxfConsumer.
>
> Well, let's assume the route is configured like:
>
>   from("cxf:...")
>   .process(new FirstProcessor())
>   .process(new SecondProcessor())
>   .process(new ThirdProcessor())
>
> In this case, if the first processor is the one to return the fault, and
> that it only returns a fault, then the second and third processor will be
> executed.
>
> Whereas, if the processor throws the exception (generated by CXF and
> containing all @WebFault annotations, remember) then the second and third
> processor won't be executed.
>
> Do you think my use case is wrong?
>

You processor has to set the fault flag on the message to indicate its a fault.
So in your first processor you do

exchange.getOut().setFault(true);
exchange.getOut().setBody("Some faulty body");

Then Camel should "detect" the fault and break out of routing and not
invoke the 2nd, 3rd processors.

And if you want Camel error handling to react upon fault messages, you
need to configure it to do so using .handleFault() in the DSL.

> Cheers
>
> S. Ali Tokmen
> savas-ali.tokmen@bull.net
>
> Office: +33 4 76 29 76 19
> GSM:    +33 66 43 00 555
>
> Bull, Architect of an Open World TM
> http://www.bull.com
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message