Dec 19th, 2010, 06:13 AM
I understand spring batch 2 allows chunk read and only call writer once at end of the chunk.
If I set commit interval of my tasklet to 5, that means spring batch will divide the input dataload into 5 groups, and call the reader 5 times and only call writer once at the end of step?
The reason why I am asking this question is that I want to create a zip file to include all the input read in itemwriter. I don't want to create multiple zip files.
Please help. thanks!
Dec 20th, 2010, 04:58 PM
Each call to reader gives 1 item.
Each call to processor takes 1 item and returns 1 item.
Each call to writer takes 1 "batch" of items, depending on your batch size (1, 1000, whatever).
If you want your writer to do the entire file at once, then you just need an item writer that keeps streaming the stuff to your zip file on disk until you are done.
Mar 31st, 2011, 01:42 AM
Write entire chunk once
Hi, we have a similar requirement where we read a bunch of records, process them one by one, but would like to write all of them at once. We are using Spring Batch 2.1.7 and commit-interval seems to be a mandatory parameter.
Could you please let us know how this could be achieved in Spring Batch?