Hi Bart Glad it's working for you. Please feel welcome to write again if you need assistance.
Med venlig hilsen Claus Ibsen ...................................... Silverbullet Skovsgårdsvænget 21 8362 Hørning Tlf. +45 2962 7576 Web: www.silverbullet.dk -----Original Message----- From: Bart Frackiewicz [mailto:[EMAIL PROTECTED] Sent: 12. september 2008 11:20 To: [email protected] Subject: Re: Splitter for big files Hi Claus, we used your code as a first draft and it works like a charm. I would like to thank you for your great support. Note: we added scannr.close() and added also the typical headers (size and counter) from the splitter. Bart Claus Ibsen schrieb: > Hi > > A workaround I can think off right now > > // read the big file and split it into lines and send each line to the seda > queue (async). > From("file://mybigfiles").process(new Processor() { > public void process(Exchange e) { > // need to get hold of a producer template to easily send the lines to > the sede queue > final ProducerTemplate template = > e.getContext().createProducerTemplate(); > > // get the file from the body > File file = e.getIn().getBody(File.class); > // create the scanner that split lines without reading all into memory > // mind you can also pass in a encoding if you like to the scanner > Scanner scanner = new Scanner(file); > // use our token as delimiter > scanner.setDelimiter("\n\r"); > // loop and send each line to the seda queue > while (scanner.hasNext()){ > String line = scanner.next(); > template.sendBody("seda:myfileline", line); > } > }); > > // then do what you normally would do next > from("seda:myfileline").to("xxxx"); > > > Mind the code is pseudo code written in email editor. >
