Question

I want to use Spring Batch for CSV Parsing-> do some processing -> store result of job in db: For every line in CSV it should do following :

1) Read line of CSV file
2) parse it
3) use the parsed tokens to do some processing
4) Store the result(success/failure with reason) of this processing in database.

I am new to Spring-Batch. I saw some examples on line. But i did not see results stored line by line. Could anyone please guide me whether this is possible in Spring batch?

Thanks in advance.

Était-ce utile?

La solution

Spring batch reads line by line and processes line by line. However, to optimize the writing we write all of the chunk at once. If you want to process your file line by line, committing (and therefore writing) each line one at a time, all you need to do is change the commit-interval to 1.

You can read more about how to get started using Spring Batch with this Getting Started Guide from Spring: http://spring.io/guides/gs/batch-processing/

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top