Given a Spring Batch job that uses chunk oriented processing to read data from a file, perform some processing on the data and write the transformed records to the database, is there a way to skip a record in case there is an exception while writing to the database and proceed with the next record? (Some kind of an interceptor?)
Also, as I understand, When a record in a given chunk cannot be written (value greater than length of the database column for example), the entire chunk would fail. What I want is to pass this record to some interceptor that can then try to fix the issue by correcting the value or write the error record to some log file and proceed with the next record rather than failing the batch. I am aware that Spring Batch provides some inbuilt listeners that get triggered on exception but I am unable to figure out how to use them to do what I want.
How do go about achieving this requirement in Spring Batch?