Hello,

I'm currently trying to get a Route going to read large csv files and
writing their content to xml. The xml has to look like the following:
<base>
<head>
static content here
</head>
<body>
csv content here by line
</body>
<body>
...
</base>


Following an example of how my route operates:

// read files
from("file:/path/to/file/file.csv")
.multicast("direct:header", "direct:data", "direct:footer");

// write XML header 
from("direct:header")
.process(WriteXmlHeaderProcessor)
.to("file:/path/to/file/?fileName=${file:onlyname.noext}.xml");

// write data
from("direct:data")
.split(body().tokenize("\r\n|\n|\r"))*.streaming()*
.process(ReadSingleLine)
.to("file:/path/to/file/?fileName=${file:onlyname.noext}.xml&fileExist=Append")
.end();

// write closing XML tags
from("direct:footer")
.process(WriteXmlFooterProcessor)
.to("file:/path/to/file/?fileName=${file:onlyname.noext}.xml&fileExist=Append");

Now my question: http://camel.apache.org/splitter says that streaming will
not guarantee the order of sub-messages but I need the xml to contain
exactly the same order as the csv. As the intput files can be rather large,
I need some form of streaming to read them one line/chunk at a time. Does
streaming still cause lines to be out of order even if I'm not using
parallel processing? In the end I will use 40+ Routes for different
directories containing files, could that be a problem?

I tried writing my own splitter using an Iterator over a
BufferedReader/LineIterator but it will still load the whole file.

What would be the best course of action to take?

Thanks for any help
Christopher




--
View this message in context: 
http://camel.465427.n5.nabble.com/Split-streaming-and-order-of-sub-messages-tp5771314.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to