admin管理员组文章数量:1241106
I'm describing the current behavior below,
- Total records = 10
- Total records picked by a Thread (or Chunk Size) = 5
- Total Threads = 2
SkipPolicy is configured to skip 2 records at Job level.
Let's say Thread-1 processed it's Chunks successfully.
Below described is execution of Thread-2,
- 1st, 2nd records processed successfully.
- 3rd record processing failed (coz it's an invalid record & throw an Exception), Thread-2 chunk fails.
Now, record 1,2 are rollbacked. Then record 1,2 are picked, re-processed by another Thread and records 4,5 are also picked by another Thread and processed successfully.
I want to avoid this complete failure of Chunk when few records are invalid and skip them up to limit (i.e. 2 records at Job level).
Is their a way to achieve it using Spring Batch capabilities?
Note: I was thinking of custom approach wherein I won't be using SkipPolicy, instead I will have a counter for invalid record (and not throwing an Exception, just increment the counter) at JobExecution level. This approach will work by not failing the Chunk, instead skipping invalid records at Job level up to a limit. But it will make the Spring Batch tables data inconsistent (i.e. all invalid records will be considered good ones). Any views on this approach too?
本文标签:
版权声明:本文标题:java - Continue processing of a Chunk after few records failed, instead of failing complete Chunk & rollbacking the alre 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740104527a2225032.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论