Reputation: 23
I am bit puzzled here, I need to do a task similar to the following scenario with Spring Batch
But here I am struggling to understand how I can give generated CSV file output of 2a to save in DB 2b. Consider CSV File has approx 1000+ Person Data which are processed for a single day.
is it possible to merge 2a & 2b? I thought about CompositeItemWriter but as here we are combining 1000+ employee in CSV file so it won't work.
Upvotes: 2
Views: 2140
Reputation: 31600
Using a CompositeItemWriter
won't work as you will be trying to write an incomplete file to the database for each chunk..
I would not merge 2a and 2b. Make each step do one thing (and do it well):
Step 1 can use the job execution context to pass the name of the generated file to step 2. You can find an example in the Passing Data To Future Steps section. Moreover, with this setup, step 2 will not run if step 1 fails (which makes sense to me).
Upvotes: 2