Sep 16th, 2011, 09:31 AM
Reading a file currently being written
I have a component A which appends lines at the end of a text file, during one hour. I have a job with one step. The steps consists of reading to this file line after line (I use FlatFileItemReader), processing the lines and writing them to a database. I don't want my batch application to wait one hour before to start reading. When the step starts, the FlatFileItemReader is created and initialized (step scope), and at this moment, I want the step to start reading the already written lines.
Is it possible?
Sep 26th, 2011, 02:26 AM
Any idea? My question is simple, is the FlatFileItemReader adapted for reading a file currently being written? Is there a problem of locking? I've done some tests with my application and sometimes I get a FlatFileParseException, and if i look at the line that has been read, it is incomplete.
(I precise that only new lines are appended to the file, i think in this case the situation is simpler).