Hi

The correlation expression in your aggregator is wrong. You use body()
which is likely not what you want.
If you just want to put all in the same group then use a constant
instead, eg constant(true) or something.

I suggest to read about the aggregate EIP again. And if you have a
copy of Camel in Action book, then chapter 8 covers this EIP
extensively and explains how it works also from the inside and its
principle etc.

The EIP book has also great covered of the EIPs as a background
material. This book is highly recommended.
For people wanting to know more about the EIPs in general




On Thu, Aug 1, 2013 at 5:28 PM, roger_rabbit <roger_rab...@gmx.fr> wrote:
> Hi,
>
> I have a strange problem that may be related to my poor knowledge of  EIP
> <http://camel.apache.org/eip.html>  . But althouth I took time to read the
> whole of it, I may have missed stg cause I couldn't find a solution.
>
> Thus, here is it :
> I have 2 routes, one filtering incoming (XML as String) messages, and the
> other one getting the queued messages from this filtering and aggregating
> them, and enventually marshall/zip them...
> My problem is that the completion that is number-based is never reached...
> though far more than the expected amount of messages are read from the
> queue. And if I remove my filter, everything works fine (but for my
> former-filter indeed)... thus If you have any tip on what I am doing wrong,
> I will listen it with great care from my beginner ears.
>
>         from("direct:files") // xml as String messages
>           .choice()
>                 .when().xpath("//root/total='0'")
>                     .log("no items found for " + 
> simple("${in.headers[itemId]}") + " :
> skipping this item")
>                     .stop()
>                 .otherwise()
>                 .inOnly("direct:items");
>
>         from("direct:items")
>                         .process(processItems)
>                         .aggregate(body(),new AggregationStrategy() {
>                                                          public Exchange 
> aggregate(Exchange oldExchange, Exchange
> newExchange) {
>                                                                 if 
> (oldExchange == null) {
>                                                                     return 
> newExchange;
>                                                                 }
>
>                                                                 String 
> oldBody = oldExchange.getIn().getBody(String.class);
>                                                                 String 
> newBody = newExchange.getIn().getBody(String.class);
>                                                                 
> oldExchange.getIn().setBody(oldBody + "+" + newBody);
>                                                                 return 
> oldExchange;
>                                                     }
>                                                 })
>                         .completionSize(10) // completed only when I work 
> directly on
> "direct:files"
>                         .convertBodyTo(byte[].class, "UTF-8")
>                         .marshal().gzip()
>                         .setHeader(
> Exchange.FILE_NAME,constant("${date:now:yyyyMMddHHmmssSSS"}.gz"))
>                         .to(folderOutUri);
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Aggregator-won-t-work-with-filter-tp5736645.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to