0 Replies Latest reply on Apr 3, 2017 9:32 AM by nias

    camel-split and aggegrate not working as expected

    nias

      hello,

       

      i've a simple camel-split/aggegration implementation which don't work as expected (stripped down for simplicity):

       

      <route id="SyncModule" streamCache="true" handleFault="true">

        <from uri="switchyard://CronTriggered"/>

       

           //....fetch xml with many <add> elements...

       

           <split strategyRef="SimpleBodyStringConcatAggegrationStrategy">

             <xpath>//add</xpath>

             <to uri="direct:transferTo"/>

             <log message="Finished Contract ${exchangeProperty.contractNumber}" loggingLevel="INFO"/>

           </split>

           <log message="Sync FINISHED: ${exchangeProperty.rangeStart} - ${exchangeProperty.rangeEnd}, contracts processed = ${header.CamelSplitSize}, ${body}"/>

           <setBody><simple><![CDATA[<result>${body}</result>]]></simple></setBody><!-- single-root-xml-result -->

       

       

      <route id="transferTo" streamCache="true" handleFault="true">

         <from uri="direct:transferTo"/>

         <onException>

              <exception>java.lang.Exception</exception>

              <!--<onWhen><simple>${exception.message} contains 'java.lang.IllegalArgumentException'</simple></onWhen>-->
              <handled><constant>true</constant></handled>

              <setBody><simple><![CDATA[<failed><ref>${exchangeProperty.contractNumber}/${exchangeProperty.salescontractnumber}</ref>${exception.message}</failed>]]></simple></setBody>

              <log message="Contract Failed ${exchangeProperty.contractNumber}/${exchangeProperty.salescontractnumber}: ${exception.message}" loggingLevel="ERROR"/>

         </onException>

       

         <setProperty propertyName="salescontractnumber"><xpath resultType="java.lang.String">//salescontractnumber</xpath></setProperty>

         <setProperty propertyName="contractNumber"><xpath resultType="java.lang.String">//contractNumber</xpath></setProperty>

         <setHeader headerName="{http://www.w3.org/2005/08/addressing}To">

              <method ref="DynamicSoapEndpointWSAddressing" method="createAddressTo('http://localhost:8080/services/ContractHistoryImporterService')"/>

         </setHeader>

         <to uri="switchyard://ContractSyncReference?operationName=add"/><!-- SOAP-Reference-Binding -->

         <setBody>

              <simple><![CDATA[<success><ref>${exchangeProperty.contractNumber}/${exchangeProperty.salescontractnumber}</ref>${body}</success>]]></simple>

         </setBody>

        </route>

       

      if the last splitted entry was catched in onException (thrown from a Soap-fault in switchyard://ContractSyncReference) in the "transferToApo2" route, i will never receive the "Sync FINISHED" log statement and therefore call of this component don't get the expected result.

      The "SimpleBodyStringConcatAggegrationStrategy" does what it sounds like, concat the body as string together, nothing more.

      If i change "handled" to "continued" it works, but then i got the additional body with <success> wrapping.

       

      Whats wrong here?