I have a spring batch applications with flat file as item reader. This flat contains two different types of records. In the definition of my chunk i have to specify a dynamic commit interval. The application has to commit each time it reads a new type of record.
Example :
1, 'recordType1', 50
1, 'recordType1', 51
1, 'recordType1', 52
COMMIT
2, 'recordType2', 'foo'
COMMIT
1, 'recordType1', 53
COMMIT
2, 'recordType2', 'foo'
COMMIT
1, 'recordType1', 50
1, 'recordType1', 50
1, 'recordType1', 50
1, 'recordType1', 50
COMMIT
2, 'recordType2', 'foo'
2, 'recordType2', 'foo'
2, 'recordType2', 'foo'
2, 'recordType2', 'foo'
COMMIT
How can I do this ?