I have a Spring batch job
with standard reader , writer and processor
I have a simple requirement like below :
1)Whatever records reader reads all should be passed to writer by processing through processor
2)My reader reads records by SQL query So if reader reads 100 records , all should be passed to writer at once
3)If it reads 1000 records , all 1000 should be passed at once
4)So in essence , commit-interval is dynamic here and not fixed.
5)Is there any way we can achieve this ?
EDIT :
To give more clarity , in sprint batch , commit-interval plays a role of chunk oriented processing E.g : if chunk-size = 10 , reader reads 10 records , passes one record 1 by 1 to processor and at commit-interval (count = 10 ) , all records are written by writer .
Now what we want is dynamic commit-interval. Whatever is being read by reader , all will be passed to writer at once