2 Replies Latest reply on May 22, 2012 6:38 PM by murray.hughes

    how to do sync split-gather

    Newbie

      Trying an aggregate route. Want to split the processing of a message into two parallell routes & gather the results & return them to the http caller. seda:response receives the two bodies aggregated OK.:)  I want to return the result from there. Trouble is: the http caller gets a response of "aggregate exit id body process2 " (not aggregated). Instead I want the http caller to receive a response of the aggregated bodies, not just process2, - just like seda:response receives. I've tried setting InOnly after the aggregate - to no avail.

       

       

       

       

       

      Any Ideas ?

       

       

       

         

               <log logName="test" loggingLevel="INFO" message="Got header $ and body $"/> <!--     <unmarshal> --> <!--       <jaxb prettyPrint="true" contextPath="GeneratedPackageName"/> --> <!--     </unmarshal> -->           <setHeader headerName="NumMessages">                  <simple>2</simple>           </setHeader>           <setHeader headerName="correlationId">                  <simple>$

                <log logName="test" loggingLevel="INFO" message="process1 id $ correlationId ${header.correlationId}"/>           <transform>                <simple>process1 </simple>           </transform>           <to uri="seda:aggregate"/>      </route>      <route>           <from uri="seda:process2" />           <log logName="test" loggingLevel="INFO" message="process2 id $ correlationId ${header.correlationId}"/>

                 

                <log logName="test" loggingLevel="INFO" message="aggregate entry. id $  correlationId ${header.correlationId}"/>         <aggregate eagerCheckCompletion="true" strategyRef="aggregatorStrategy" >              <correlationExpression>                 <simple>header.correlationId</simple>             </correlationExpression>             <completionSize>                 <header>NumMessages</header>             </completionSize>                         <log logName="test" loggingLevel="INFO" message="Inside aggregate"/> <!--             <transform> --> <!--                     <simple>OK</simple> --> <!--                </transform> -->                <log logName="test" loggingLevel="INFO" message="Inside aggregate exit id $  correlationId ${header.correlationId}"/>

       

                <log logName="test" loggingLevel="INFO"

                     message="aggregate exit $  correlationId ${header.correlationId}" />         <transform>                <simple>aggregate exit $ body $</simple>           </transform>           <setExchangePattern pattern="InOnly"/>           <to uri="mock:aggregate" pattern="InOnly"/>            <!--           <log logName="test" loggingLevel="INFO" message="aggregate failed"/> --> <!--           <to uri="mock:aggregate"/> -->      </route>           <route >           <from uri="seda:response" />           <log logName="test" loggingLevel="INFO" message="response entry id $ and body $  correlationId ${header.correlationId}"/>

                 

                <log logName="test" loggingLevel="INFO"  message="response exit body $"/>

                 

      7849 INFO test - Got header ID-NZ-HUGHESM-05-55719-1337661601077-0-2 and body &lt;?xml version="1.0" encoding="UTF-8" ?&gt; ...

      7850 Camel (camel-1) thread #0 - seda://process1 INFO test - process1 id ID-NZ-HUGHESM-05-55719-1337661601077-0-2 correlationId ID-NZ-HUGHESM-05-55719-1337661601077-0-2

       

       

      7850 Camel (camel-1) thread #1 - seda://process2 INFO test - process2 id ID-NZ-HUGHESM-05-55719-1337661601077-0-2 correlationId ID-NZ-HUGHESM-05-55719-1337661601077-0-2

       

       

      7850 Camel (camel-1) thread #2 - seda://aggregate INFO test - aggregate entry. id ID-NZ-HUGHESM-05-55719-1337661601077-0-7 correlationId ID-NZ-HUGHESM-05-55719-1337661601077-0-2

       

       

      7850 Camel (camel-1) thread #2 - seda://aggregate INFO test - aggregate exit ID-NZ-HUGHESM-05-55719-1337661601077-0-7 correlationId ID-NZ-HUGHESM-05-55719-1337661601077-0-2

       

       

      7850 Camel (camel-1) thread #2 - seda://aggregate INFO test - aggregate entry. id ID-NZ-HUGHESM-05-55719-1337661601077-0-8 correlationId ID-NZ-HUGHESM-05-55719-1337661601077-0-2

       

       

      7850 Camel (camel-1) thread #2 - seda://aggregate INFO test - Inside aggregate

       

       

      7850 Camel (camel-1) thread #2 - seda://aggregate INFO test - Inside aggregate exit id ID-NZ-HUGHESM-05-55719-1337661601077-0-7 correlationId ID-NZ-HUGHESM-05-55719-1337661601077-0-2

       

       

      7850 Camel (camel-1) thread #3 - seda://response INFO test - response entry id ID-NZ-HUGHESM-05-55719-1337661601077-0-7 and body process1 +process2 correlationId ID-NZ-HUGHESM-05-55719-1337661601077-0-2

       

       

      7850 Camel (camel-1) thread #3 - seda://response INFO test - response exit body OK

       

       

      7850 Camel (camel-1) thread #2 - seda://aggregate INFO test - aggregate exit ID-NZ-HUGHESM-05-55719-1337661601077-0-8 correlationId ID-NZ-HUGHESM-05-55719-1337661601077-0-2

       

       

       

       

      Caller result =

       

       

      aggregate exit ID-NZ-HUGHESM-05-55719-1337661601077-0-8 body process2

       

      Edited by: murray.hughes on May 22, 2012 4:51 AM