Yeah

See     void setHandleFault(Boolean handleFault);
on RuntimeConfiguration which CamelContext extends.

So you can do in a Java DSL route builder

                context.setHandleFault(true);


from("direct:start").to("log:foo").to("log:bar").to("mock:result");

Or you can enable it on a per route basis

                from("xxx").handleFault().to("yyy");

On Sun, Mar 7, 2010 at 12:37 PM, Willem Jiang <willem.ji...@gmail.com> wrote:
> Hi Claus,
>
> I didn't find there is a soapFault option int he CamelContext or cxfEndpoint
> URI.
>
> BTW,
> There is HandleFault InterceptStrategy, which could be used to turn a fault
> message into a exception.
> Here is the DSL for configure it
> public void configure() throws Exception {
>     HandleFault handleFault =new HaneleFault();
>     getContext().addInterceptStrategy(handleFault);
>     ...
> }
>
> Willem
>
> Claus Ibsen wrote:
>>
>> Hi
>>
>> You can enable the soapFault=true on the CamelContext which turns
>> faults into exceptions.
>>
>> Or you can simply add a processor step at the end of your route, and
>> check if the exchange is a fault
>>
>> public void process(Exchange exchange) {
>> boolean isFault = exchange.hasOut() && exchange.getOut().isFault();
>> // do something before the OUT message is returned to the caller
>> }
>>
>>
>> On Sat, Mar 6, 2010 at 4:51 PM, Jim Talbut <jtal...@spudsoft.co.uk> wrote:
>>>
>>> Hi,
>>>
>>> I have a route that looks like this:
>>>               from( sourceEndpoint )
>>>                       .onException( java.lang.Throwable.class ).process(
>>> new Processor() {
>>>                               public void process(Exchange exchange)
>>> throws
>>> Exception
>>>                               {
>>>                                   log.warn( "onException\n\n\n\n" );
>>>                                   Throwable caused =
>>> exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
>>>                                   log.info( "caused = " +
>>> caused.getClass().getCanonicalName() );
>>>                                   log.info( "caused = " +
>>> caused.getMessage() );
>>>                                   log.info( "caused = " +
>>> caused.toString()
>>> );
>>>                                   log.info( "caused = " + caused );
>>>                               }
>>>                           }).end()
>>>                       .to( destinationEndpoint );
>>>
>>> Both sourceEndpoint and destinationEndpoint are CXF endpoints.
>>> When destinationEndpoint is unavailable (the server is down) the
>>> onException
>>> handler is thrown correctly.
>>>
>>> But if destinationEndpoint returns a SOAP:Fault onException isn't
>>> triggered
>>> and I can't find out how to modify the SOAP:Fault that the clients of
>>> sourceEndpoint receive.
>>> I need to ensure that SOAP:Server faults are modified before being
>>> returned
>>> to the client.
>>>
>>> I tried adding a processor, but that only gets called on the way In,
>>> whether
>>> it returns a fault or not.
>>>
>>> I'm new to camel but I've managed to get most of my requirements met,
>>> leaving me with just this problem that's got me completely stumped.
>>>
>>> Thanks
>>>
>>> Jim
>>>
>>>
>>
>>
>>
>
>



-- 
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

Reply via email to