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.