Item processor rollbacks & starts over again if exception occurs in between
We have been using spring batch framework for few months now. Yesterday we noticed that batch processing doesnt exactly happen the way we thought it would.
1. Expected : Read-Process, Read-Process till chunk limit is reached, then write the entire chunk.
Actual Behavior: But ItemReader actually reads the items in one go and then control goes to the processor.
Shouldn't it read one item, process it and then proceed with reading the next item?
2. Assume 4 items were read and now control goes to the processor. Here, lets say an exception occurs while processing the third item and this exception is skippable according to our skipPolicy, then we would expect the system to skip this item and proceed with its processing till the chunk limit is reached and then write them.
But when such a exception occurs, item processor rollsback and starts processing from the first item again, but this time it doesn;t process those items which led to exceptions. Why is this rollback happening?
With chunk limit ,say 10000, exception in 9999th item will lead to a rollback and thus a very bad delay.
http://my.safaribooksonline.com/book...UxODI5NTUvMjMx link doesnt explain why spring batch behaves this way.
Relevant link : http://www.coderanch.com/t/548941/Sp...t-Interval-not
It would be great if someone can enlighten us :)
P.S : We use spring batch version 2.1.8