Spring batch commit interval for CompositeItemWriter

466 Views Asked by At

How does spring batch identify the commit interval in a compositeItemWriter?

If my commit-interval=50000, and I have a CompositeItemWriter, which has 4 different writers included, each of which is passed a list of 50000 records. Is the transaction committed at the end of writing 200000 ( 50000 * 4) records ?

If 1 of the itemWriters fails due to an exception, what happens to the entire transaction?

1

There are 1 best solutions below

0
On BEST ANSWER

The CompositeItemWriter will write 50k objects. Therefore each delegate writer will write 50k objects, resulting in 200k total writes in your case.

The question of Transaction management is hugely complex, but in an ideal world, all 4 writers will roll back so you can restart at the beginning of the chunk that failed