【问题标题】:How to use chunk processing with Spring Batch?如何在 Spring Batch 中使用块处理?
【发布时间】:2014-03-31 14:55:08
【问题描述】:
我是第一次使用 Spring Batch。我尝试了一些示例并通读了文档。但我还有疑问:
非常感谢,
弗洛里安
【问题讨论】:
标签:
spring
batch-processing
spring-batch
【解决方案1】:
跳过块只需抛出一个已声明为“可跳过的异常”的异常。你可以这样做:
<step id="step1">
<tasklet>
<chunk reader="reader" writer="writer"
commit-interval="10" skip-limit="10">
<skippable-exception-classes>
<include class="com.myapp.batch.MyException"/>
</skippable-exception-classes>
</chunk>
</tasklet>
</step>
条件流可以很容易地实现决定步骤执行的ExitStatus:
<job id="job">
<step id="step1" parent="s1">
<next on="*" to="stepB" />
<next on="FAILED" to="stepC" />
</step>
<step id="stepB" parent="s2" next="stepC" />
<step id="stepC" parent="s3" />
</job>
阅读文档以深入了解这些主题:http://docs.spring.io/spring-batch/reference/html/configureStep.html