3 Replies Latest reply on Mar 4, 2014 8:57 AM by Keith Babo

    Switchyard invocation terminates prematurely when using handled(true) in Camel route

    Bernard Tison Newbie



      I have a SY component implemented as a camel route. In this route I want to do some error handling, for which I use Camel onException() and handled(true) constructs. The component is exposed over a SOAP gateway.

          .process(new Processor() {
               public void process(Exchange exchange) throws Exception {
               //error processing


      When a call to OrderServiceReference returns a SOAP fault, the onException block is executed, as expected. However the overall Switchyard invocation terminates, and the SOAP client which invoked the SY service receives a timeout.


      The root cause seems to be:

      When the Camel processor executes the handled(true) directive, it places a property `CamelErrorHandlerHandled` with value `true` on the Camel Exchange. The presence of this property causes the termination of the Camel processing pipeline.

      When control is returned to the SY processor, all properties from the Camel exchange are copied to the SY Exchange, including the `CamelErrorHandlerHandled` property. This then causes the SY processing pipeline to terminate.


      Switchyard version: 1.1.1-p5-redhat-1 (version used in FSW 6.0.0 GA)


      Possible fix:

      In `org.switchyard.common.camel.ContextPropertyUtil.isReservedProperty()` I added `CamelErrorHandlerHandled` to the reserved properties, to avoid the property from being copied to the SY exchange.


      Attached a maven project that demonstrates the observed behaviour. It consists of a web service and a SY jar with a Camel route. The `src/test/resources/soap` folder of the sy project contains sample soap requests. The `soap-bad.xml` generates a time-out.