Take the 2-minute tour ×

I'd like to develop a route that polls a directory containing CSV files, and for every file it unmarshals each row using Bindy and queues it in activemq.

The problem is files can be pretty large (a million rows) so I'd prefer to queue one row at a time, but what I'm getting is all the rows in a java.util.ArrayList at the end of Bindy which causes memory problems.

So far I have a little test and unmarshaling is working so Bindy configuration using annotations is ok.

Here is the route:

  .bindy(BindyType.Csv, "com.ess.myapp.core")           

Environment is: Eclipse Indigo, Maven 3.0.3, Camel 2.8.0

Thank you

share|improve this question
add comment

1 Answer

If you use the Splitter EIP then you can use streaming mode which means Camel will process the file on a row by row basis.

    .unmarshal().bindy(BindyType.Csv, "com.ess.myapp.core")           
share|improve this answer
Thanks Claus for your answer. Now I'm facing a different problem. Following on my little exercise I'm trying to extract from the queue and write to a file with .convertBodyTo(String.class).to("file:data/outbox?fileExist=Append") but only the first row gets written. All the same, if I use the file option Override I get only the last row. Is there a way to have all the rows from the CSV file written to the file?. Thank you –  Taka Nov 15 '11 at 15:46
You need to specify a file name, .to("file:data/outbox?fileName=data.csv&fileExist=Append") –  Claus Ibsen Nov 16 '11 at 10:34
Add .thread() after .streaming() could it be more efficient ? –  pith Oct 24 '12 at 7:28
The splitter EIP has built-in support for multi-threading, you can refer to an executorService. This would be more ideal to use that, than threads. But the latter is also possible. See the Camel docs for examples. –  Claus Ibsen Oct 29 '12 at 7:10
I see tokenize by new line. What about multiline rows? Are the supported? –  Daneel S. Yaitskov Dec 2 '13 at 21:34
show 1 more comment

Your Answer


