I did the same using a custom CompletionPolicy and a PeekableItemReader.
The idea behind the code is to peek next item, perfrom next element read and check from value change.
When a value change happens return true from CompletionPolicy.isComplete().
Important: this policy must be registered as step listener!
public class BreakKeyCompletionPolicy extends CompletionPolicySupport{
private BreakKeyCompletionContext cc;
private PeekableItemReader