how can I get the all the items of the chunk after the the item skipped, Thanks! #4579
Replies: 2 comments
-
@fmbenhassine would you please give me some tips?currently,from the source class of FaultTolerantChunkProcessor.java,I can only get the skipped item,not the chunk items.
|
Beta Was this translation helpful? Give feedback.
-
It is not possible to get the entire chunk using a Since you need to get all the items in the chunk to re-process them in the next step, you can use an |
Beta Was this translation helpful? Give feedback.
-
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
Beta Was this translation helpful? Give feedback.
All reactions