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.

Reply via email to