In my particular scenario, I have to persist huge entities read from files to the database but my commit-interval is configured with value = 1
. Also I'm not quite sure if the delegate processor in the CompositeItemProcessor
used are idempotent. So My question is if there is a way of preventing the wasted time on reprocessing and avoid many unused queries to the db. I also want to use a SkipListener to log the errors in reading/processing/writing into an specific table and suspect such configuration (no reprocessing) is not compliant with that.
I am using spring batch 2.1.9.
Thanks in advance.
____________________________UPDATE 07-05-2016 ____________________________
After a few days of research I realized there is a conceptual debate between some users and spring developers.
I know now that this behavior woks as designed on skipped exceptions thrown during writing phase as said by @MichaelMinella in the comment for the answer in this 2014 post:
The
ItemWriter#write
method receives a list of items. Without going through them one at a time, there is no way for us to determine which in the list threw the exception in the writer.
So is no way yet to the framework discover the failed item without scanning for the whole list (even if the chunk size is 1). The Inner behavior of the framework to do this uses the FaultTolerantChunkProcessor
and the RetryTemplate
is described in this 2013 post more discussion on the matter can be found on this spring batch forum 2012 post.