javaspring-bootspring-batchjob-schedulingjava-batch

Filtering after Read in Spring Batch


I currently have a Spring Batch in which FlatFileItemReader reads from a csv file and then based on the values read goes on executing the rest of tasklets and runs the job. I want to make a downstream external api call and based on the response object of this call I want to filter out values that are not part of this response from this before starting the job run(probably I might have to write a tasklet). Could someone help me with a detailed documentation on solutions for this? I am not able to figure out how to do this.


Solution

  • I want to make a downstream external api call and based on the response object of this call I want to filter out values that are not part of this response from this before starting the job run(probably I might have to write a tasklet).

    I see no need to do all that pre-processing before the job run. This can be done in a preparatory step before the actual processing starts in the same job.

    If the preparatory work should be done only once, then the preparatory step can be marked as non-restartable, so that in case of failure, the job does not re-execute it and resumes the execution from the processing step.