Background
I currently have a spring-batch job that reads a flat file. The job uses a MultiResourcePartitioner
to read physical partitions of a file that has been split into N number of smaller files. This means that each physical partition of the file will result in a new slave step being executed that reads the partition.
The problem
If there is any issue reading any physical partition, the execution of that slave step will fail and the exception will be logged by spring batch. This does not impact the execution of the remaining slave steps that are reading different physical partitions of the file; however, this is not the desired behavior. What I want is that if there is an issue reading a particular physical partition (Example : not being able to parse a particular column), the exception should be propagated to the location where the Job
was launched so that I can halt any further processing.
The current implementation of the execute method in AbstractStep
catches Throwable
and suppresses the exception by logging it. As a result, the exception is not propagated to the location where the Job
was launched and there is no way to halt the execution of the remaining slave steps.
How can I make spring-batch propagate any exception that occurs in a slave step all the way to the location where the Job
was launched? I want to do this so that I can halt any further processing if there is an issue processing any of the partitioned files.