I have two steps job.
Step1 ends up writing to file using AsyncItemWriter, while I am writing to a file I want to check every record if it has any error in it (imagine record object with error flag in it). In step 2, if any of the previously written records has an error in it then I want to copy written file to s3 else delete that written file. Currently I am storing this info in Atomic boolean instance variable in my AsyncItemWriter and the @AfterStep
method reading that flag and bubbling it up to the StepExecutionContext and using that in job Flow. I feel like there is a better way for this, any suggestions?
Additional info to the question:
- I need to process entire file and let my clients know all errors in their file so that they can fix them and re-upload the file
- I am using AsycnItemProcessor + AsyncItemWriter combination in Step1