I tried this but it did not work.
Something strange however, happens. I noticed if I use the default
aggregationStrategy, the log:Response1 will be logged (as null), however if
I changed it to myAggregatorStrategy, it never prints the log (let alone
log:Response3), instead it prints log:Response2 which prints the old and new
exchange separately (at different times).
<route>
<from uri="direct:AggregatorServices" />
<aggregate strategyRef="myAggregatorStrategy" batchSize="2"
batchTimeout="30000">
<!-- <aggregate batchSize="2" batchTimeout="30000"
groupExchanges="true">-->
<correlationExpression>
<constant>true</constant>
</correlationExpression>
<to uri="log:Response1"/>
<from uri="direct:ProcessorServices" />
</aggregate>
<to uri="log:Response2"/>
</route>
<route>
<from uri="direct:ProcessorServices" />
<to uri="log:KimonoResponse3"/>
</route>
Something is wrong somewhere, just can't figure it out yet.
Claus Ibsen-2 wrote:
>
> Hi
>
> I have created an unit test which does what you want
> http://svn.apache.org/viewvc?rev=902559&view=rev
>
> You should use batchSize = 2 and not OUIT batch size. OUT batch size
> is when you have multiple correlation groups.
> Which yo do not have since you use true as the correlation id.
>
> Also note that the default timeout of 1 sec will kick in, so if you
> send in message in slow pace then set it to a higher number.
>
> The aggregator will be overhauled in the future, hopefully in 2.3
>
>
> On Fri, Jan 22, 2010 at 10:05 AM, lekkie <[email protected]> wrote:
>>
>> Hi,
>>
>> I want to combine messages from 2 different exchanges into a single
>> exchange, from the EIP patterns aggregation strategy seems to be right
>> pattern to use.
>>
>> However, after reading the doc (http://camel.apache.org/aggregator.html),
>> I
>> followed the instructns but my aggregation strategy only returns the last
>> exchange, even though I specifically configured it to send messages only
>> when the outbatchsize is 2.
>>
>> I implemented a custom aggregationstrategy with shoulld combine my
>> exchanges
>> into one. I log the event in the class and it works fine, what is beyond
>> me
>> is why it returns only the last exchange.
>>
>>
>> See my config here:
>> <bean id="myAggregatorStrategy"
>> class="org.tempuri.MyAggregationStrategy"/>
>>
>> <osgi:camelContext xmlns="http://camel.apache.org/schema/spring"
>> trace="true">
>> <route>
>> <from uri="direct:RequestProcessor" />
>> <to uri="xslt:requestToSOAP.xsl"/>
>> <wireTap uri="direct:AggregatorServices"/>
>> <to uri="xslt:requestToManager.xsl"/>
>> <convertBodyTo type="javax.xml.transform.dom.DOMSource" />
>> <to uri="nmr:{http://services.locator/}Service:ServicesPort"/>
>> <to uri="direct:AggregatorServices"/>
>> </route>
>>
>> <route>
>> <from uri="direct:AggregatorServices" />
>> <aggregate strategyRef="myAggregatorStrategy" outBatchSize="2">
>> <correlationExpression>
>> <constant>true</constant>
>> </correlationExpression>
>> <to uri="direct:ProcessorServices"/>
>> </aggregate>
>> </route>
>>
>> <route>
>> <from uri="direct:ProcessorServices" />
>> <to uri="log:Response"/>
>> </route>
>> </osgi:camelContext>
>>
>> log:Response only print out response from <to
>> uri="nmr:{http://services.locator/}Service:ServicesPort"/>.
>>
>> Meanwhile, the log inside myStratRef (myAggregatorStrategy), which I ask
>> to
>> concatenate the old & new exchanges shows both exchanges were
>> concatenated.
>> How do I get this concatenated exchange to be sent (to log:Resposne)?
>>
>> Regards.
>> --
>> View this message in context:
>> http://old.nabble.com/Aggregator%27s-not-returning-combined-exchanges%2C-only-returns-last-exchange-tp27270355p27270355.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> 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
>
>
--
View this message in context:
http://old.nabble.com/Aggregator%27s-not-returning-combined-exchanges%2C-only-returns-last-exchange-tp27270355p27297994.html
Sent from the Camel - Users mailing list archive at Nabble.com.