Spring Batch: Retry chunk in smaller chunks vs single item processing
<p>I have an application that uses Spring Batch 3.0.6.  The Spring Batch job uses chunk processing.  The commit interval is set to 100 and the retry limit is set to 5.  </p>

<p>The writer writes a data chunk (of 100 records) to another application (via TCP) when the commit interval is reached.  If one of the records is bad (for whatever reason it causes an exception), then Spring Batch attempts to write the chunk 5 times (the retry limit) and fails each time (as expected).</p>

<p>Spring Batch then attempts to find out which of the 100 records in the chunk is failing by retrying them one at a time (i.e commit interval = 1).  This seems to be the default behavior for retry.</p>

<p>Is there a way to be more efficient by retrying, say, 10 records at a time and progressively narrowing the retry size till the offending record is located.  That way if the 95th record is bad, then we find it faster than checking them one at a time starting from record 1.</p>

<p>I found this post from 2011:</p>

<p><a href="https://stackoverflow.com/questions/7025506/spring-batch-commit-interval-not-honored-after-roll-back-during-write/7026503#7026503">Spring Batch: Commit-Interval not honored after roll back during write</a></p>

<p>Is there a way to have SB try smaller chunks first to narrow down the location of the bad record.  The smaller chunk size (say, 10 items) can be an optional user configurable item and after that SB can try one item at a time to find the bad record.</p>