Skip to content

how can I get the all the items of the chunk after the the item skipped, Thanks! #4501

@kenshin614

Description

@kenshin614

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions