Hi Do you have any predicates for when the files have reached the end? Does the file have metadata such as: - File 1 of 3 Data for file 1 - File 2 of 3 Data for file 2 - File 3 of 3 Data for file 3
Then you can use that metadata for the predicate that determines the end condition is reached. See the loan broker example: http://activemq.apache.org/camel/loan-broker-example.html that shows how to use aggregate. A good example that is. However if you files do not have such meta data (File 1 of 3) then I actually think we need to discuss it some more, how to determine the "end condition". For instance the file consumer could be improved to determine the list of files at first, and then afterwards iterate this list so it can add this metadata itself to each exchange. Then you can determine the completed predicate. However I can see this problem for other consumers as well, so a more general solution would be nice to discuss. For instance maybe we need something extra to polling consumers so they can support callbacks for end. Any thoughts? Med venlig hilsen Claus Ibsen ...................................... Silverbullet Skovsgårdsvænget 21 8362 Hørning Tlf. +45 2962 7576 Web: www.silverbullet.dk -----Original Message----- From: huntc [mailto:[EMAIL PROTECTED] Sent: 30. september 2008 13:02 To: [email protected] Subject: How to use Aggregator and AggregationCollection? Hi there, Firstly, congrats on Camel. I've been using other ESBs and I'm really liking the way this one hangs together. However, I have a problem and after lots of trawling I've not been able to sort this one for myself. I'm wanting to read a bunch of files from a directory and then aggregate all of the files into a collection and then process that collection. How to do this? Here's my config so far: from( "file://target/classes/timetables?noop=true&consumer.recursive=true") .aggregator(new AggregationCollection(constant(true), this)).constant(true) .process(new Processor() { public void process(Exchange e) { System.out.println("Received exchange: " + e.getIn()); } }); ... and my strategy looks like: public Exchange aggregate(Exchange arg0, Exchange arg1) { return arg1; } Now, I know my strategy doesn't make sense (nor my config either), but I'm not quite sure what to do about a strategy here. My goal is simple enough: simply collect all of the files. Help! Kind regards, Christopher -- View this message in context: http://www.nabble.com/How-to-use-Aggregator-and-AggregationCollection--tp19739918s22882p19739918.html Sent from the Camel - Users mailing list archive at Nabble.com.
