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 jobs for skips
- [Illustrator] In some instances within a job, an exception may occur. However, the job should not be failed. Spring Batch allows for this sort of behavior through a concept known as skips. Skips allow permissible exceptions to be ignored so that jobs can continue their processing. Let's take a look at how we can configure a step to incorporate some skip logic. In order to see skip logic in action, I've added a little volatility into our Tracked Order Item Processor. Let's imagine that the tracking number, that's added by this processor is received by a third party shipper that exposes an API. So here you see we have a call to the get Tracking Number method. And let's imagine this is the call to the API. So you'll see that we can return the Tracking Number from this method, but roughly 30% of the time, it's going to throw in Order Processing Exception. So we've essentially added some volatility here, so that we can try…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.