I'm trying to implement a new behaviour on the MultiResourceItemReader from Spring-Batch, with no success so far.
Maybe i'm not looking in the right direction.
I have a few files to process (read and write in database). At the end of each file, I must create a report and move the file.
My problem is :
Let's say I have an interval-commit of 100.
FileA has 150 objects to read/write
FileB has a few unreadable objects (common error in my case)
1/ My batch will read the first 100 objects of fileA, commit.
2/ Then it reads the 50 items left of fileA, closes fileA, sends the report for the file, moves fileA to a new folder.
Then read the 50 first items from fileB, but there a RuntimeException occurs.
Because of the Exception, the transaction will rollback to the previous commit.
I am now in a state where I have only 100 items in my database, but fileA is considered done.
Is there any way to force MultiResourceItemReader to call the ItemWriter when reaching the end of a file ?
Am I doing something wrong ?
I am mighty! And this is a mighty small ad:
how do I do my own kindle-like thing - without amazon