how can I get the all the items of the chunk after the the item skipped, Thanks! #4579
-
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, Environment |
Beta Was this translation helpful? Give feedback.
Replies: 3 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.
-
I believe my last comment answers the question, so I am closing this discussion. But if you need more help on this, please add a comment. |
Beta Was this translation helpful? Give feedback.
It is not possible to get the entire chunk using a
SkipListener
, because this listener is called when the chunk is scanned item by item to determine the faulty one.Since you need to get all the items in the chunk to re-process them in the next step, you can use an
ItemWriteListener#onWriteError
. This callback gives you access to the entire chunk when an error happens, and can be used to store items in a staging area that the next step can access. Have you considered this option?