I have a batch which is doing following operations
Step 1: Reading from database using stored procedure and writing into multiple file using MultiResourceItemWriter
Step 2: Reading the files using MultiResourceItemReader, doing some processing and writing into another database. This step is parallelized using MultiResourcePartitioner
Now , for better performance, I want to parallelize step 1 and step 2, so that the moment a file write is complete by step 1, step 2 will take this file and start the processing. What would be the best way to achieve this. I am not able to find a suitable way to find out the point when a file write is complete, so that I do some operation like rename/move the file so that it can be picked up the second step.