From the course: Spring: Spring Batch

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Configuring steps for retries

Configuring steps for retries

From the course: Spring: Spring Batch

Start my 1-month free trial

Configuring steps for retries

- [Instructor] Retries can be configured to automatically retry a step in an attempt to recover from an exception. This capability increases the resilience of our job and can help in situations where the job could potentially recover from the exception it experienced. This capability is very beneficial in situations where some external resource like a service may be experiencing sporadic issues. Let's take a look at how we can configure a step to incorporate retry logic. Configuring a step for retries is very similar to configuring it for skips. So if we navigate to our chunk-based step, you'll see our configurations in place four skips already. Now we're going to be using the FaultTolerantStepBuilder, so we'll leave our call to faultTolerant in place. We are going to replace our skip method and in this case, we're going to replace it with the retry method. The retry method requires us to specify an exception, that would…

Contents