We are building a spring batch which calls an third party API in processor section in spring batch
The requirement is when the 3rd party API is not available the spring batch need to re-try for specified threshold limit and abort the batch
I have tried spring batch retry with fault tolerant step it is working fine in a single threaded program but is is not stopping the batch when we include aysncprocessor and aysncitemwriter
Can some please give me some example of retry limit / custom code on how to exit in case of any exception using aysncprocessor / asyncitemwriter
Update 1-:
I have tried with chunk size of 100 with 5 aysnc threads with retry limit 3, I see few records are processed only twice and few are processed thrice and finally job fails with ExhaustedRetryException
Is this the expected behavior of Spring batch ?
Update 2:- I see many post in forums with spring retry what is the exact difference between spring retry and faultTolerant (Spring Batch) step retry ?
it is working fine in a single threaded program but is is not stopping the batch when we include aysncprocessor and aysncitemwriter: Since its working fine let's see why it is not stopping. Are you using a thread pool executor for async components? If yes, do you shutdown this thread pool after your job? Spring Batch does not shutdown thread pools by itself. - Mahmoud Ben Hassine