-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Question description
Scenario:1000 items need to be processed, chunkSize is 10, after the first Item in the chunk meet the skip condition and happened , how can i get all the 10 items including the above skipped one in the chunk. as we know if any item in the chunk happened skip,the whole chunk will rollback. so i need to get the all the items in the chunk so as to re-process them in the next step. In the skiplistener, I can only get the only skipped item,not the whole chunk items.
pseudo java code like this,
<batch:step parent="stepTemplate" id="testSkip" next="stopSkip"> <batch:partition partitioner="xxPartitioner"> <batch:step parent="stepTemplate"> <batch:tasklet> <batch:chunk reader="skipDemoReader" processor="skipDemoProcessor" writer="skipDemoWriter" commit-interval="10" skip-limit="3" > <batch:skippable-exception-classes> <batch:include class="MySkipException"/> <batch:exclude class="java.lang.Exception"/> </batch:skippable-exception-classes> <!-- add listener --> <batch:listeners> <batch:listener ref="mySkipListener"></batch:listener> </batch:listeners> </batch:chunk> </batch:tasklet> </batch:step> </batch:partition> </batch:step>
Environment
java 8, springbatch 4.1.1 ,mysql5.7