You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by javakurious <ja...@gmail.com> on 2012/08/17 05:51:54 UTC

aggregator aggregation completion

I am looking for some tips to correctly use Aggregator component. 

The scenario is that I am getting a request in xml format, and I process
that request and get a response in XML format as well. But the request and
response are two completely different format. My goal is to create a new XML
document that combines the original request and the corresponding response,
set it as a body of the Aggregated Exchange and send the exchange to a bean
to write to database.

         <route id= "processing">
            <from uri="direct:orderRequestQueue"/>            
            <wireTap uri="seda:auditRequestQueue"/> 
            <process ref="requestProcessor"/> 
            <wireTap uri="seda:auditRequestQueue"/>     
         </route>  
 
        <route id="auditing">
            <from uri="seda:auditRequestQueue"/>            
            <aggregate strategyRef="combineXSLTAggregateStrategy"
completionSize="2">
                <correlationExpression>                    
                    <simple>header.breadcrumbId</simple>
                </correlationExpression>                
                <bean ref="db-processor" method="writeToDatabase"/>
            </aggregate>
        </route>

Above, I am trying to send the request and the response to
'seda:auditRequestQueue'. The strategy ref is supposed to run a
transformation to create a new xml document. I am using header.breadcrumbId
as the correlation expression. I have set the completionSize to '2', so once
both request and response is set to auditRequestQueue, the strategyRef is
going to be executed. 

But, for some reason the strategyRef is never executed, the route keeps
waiting for 2 related messages to arrive. 

What am I doing wrong ??? How can I debug it ?

Thanks for any help !



--
View this message in context: http://camel.465427.n5.nabble.com/aggregator-aggregation-completion-tp5717567.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: aggregator aggregation completion

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Aug 17, 2012 at 5:51 AM, javakurious <ja...@gmail.com> wrote:
> I am looking for some tips to correctly use Aggregator component.
>
> The scenario is that I am getting a request in xml format, and I process
> that request and get a response in XML format as well. But the request and
> response are two completely different format. My goal is to create a new XML
> document that combines the original request and the corresponding response,
> set it as a body of the Aggregated Exchange and send the exchange to a bean
> to write to database.
>
>          <route id= "processing">
>             <from uri="direct:orderRequestQueue"/>
>             <wireTap uri="seda:auditRequestQueue"/>
>             <process ref="requestProcessor"/>
>             <wireTap uri="seda:auditRequestQueue"/>
>          </route>
>
>         <route id="auditing">
>             <from uri="seda:auditRequestQueue"/>
>             <aggregate strategyRef="combineXSLTAggregateStrategy"
> completionSize="2">
>                 <correlationExpression>
>                     <simple>header.breadcrumbId</simple>
>                 </correlationExpression>
>                 <bean ref="db-processor" method="writeToDatabase"/>
>             </aggregate>
>         </route>
>
> Above, I am trying to send the request and the response to
> 'seda:auditRequestQueue'. The strategy ref is supposed to run a
> transformation to create a new xml document. I am using header.breadcrumbId
> as the correlation expression. I have set the completionSize to '2', so once
> both request and response is set to auditRequestQueue, the strategyRef is
> going to be executed.
>
> But, for some reason the strategyRef is never executed, the route keeps
> waiting for 2 related messages to arrive.
>
> What am I doing wrong ??? How can I debug it ?
>

Make sure your correlation expression would give the same result for
the 2 messages, otherwise the aggregator EIP cannot match the 2
messages. And then it wont call the strategyRef to "merge" the 2 of
them.

So can you double check that header is the same for the 2 of them?


> Thanks for any help !
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/aggregator-aggregation-completion-tp5717567.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen