user1570345
user1570345

Reputation: 203

spring batch its always gets retried immediately when exception, though retry configuration is not specified

I have the below chuck step configuration. One of the processor is REST API POST call. so I dont want to retry if there is any exception. But even after I remove the retry configuration, it still retries immediately once from the reader step for the failed item. What could be missing here? Thank you.

return stepBuilderFactory.get("chunkStep")
                .<File, CoopReqDTO>chunk(1)
                .reader(filesReader)
                .processor(processor())
                .faultTolerant()
                //.retry(Exception.class)
                //.retryLimit(1)
                .skip(Exception.class).skipLimit(Integer.MAX_VALUE)
                .listener(pdfCaptureSkipListener)
                .writer(compositeItemWriter())
                .build();

Upvotes: 1

Views: 1668

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31590

You can use FaultTolerantStepBuilder#noRetry to exclude any exception and (its subclasses) from the retry. You might also check FaultTolerantStepBuilder#processorNonTransactional if you want to cache processing results (this might be useful in your case to avoid re-doing a POST request).

Upvotes: 3

Related Questions