Nov 5th, 2012, 10:38 PM
MultiResourceItemReader & FlatFileItemReader - Processing multiple Files
I have a requirement where by I need to process multiple input files one after the other and record if there are any issues with the file.
example - Say there are 3 files (File-1,2,3) in the directory
a) records in File-1 has no errors - so I need to insert a record in DB with file name and status as "S" (success)
b) records in File-2 has partial errors (10 out of 100 records has validation errors) so log it in DB table with file name and status as "P" (partial)
c) all the records in File-3 are failed (100 out of 100 records has validation errors) so log it in DB table with file name and status as "F" (failure)
How can I accomplish the above requirement by using FlatFileItemReader and send the file name and error count to Writer, how do I do that.