【发布时间】:2014-02-14 14:30:08
【问题描述】:
我在 Spring Batch 中遇到了以下设计缺陷。
- 步骤必须具有 Next 属性,除非它是拆分流的最后一个步骤或最后一个步骤。
- Decider 块必须处理 Decider 返回的所有情况。
因此,在拆分流中,最终步骤不会有 Next 属性,如果有一个 Decider 保护它,那么它必须有一个 Next 属性。所以它不应该有那个属性,但它也需要它。第 22 条。
例子:
<!-- Process parallel steps -->
<split id="split01">
<flow>
<step id="step1" next="step02">
<!-- Do something -->
</step>
<step id="step02">
<!-- Do something else -->
</step>
</flow>
<flow>
<step id="step03">
<!-- Do something -->
</step>
<!-- Only run under specific conditions -->
<decision id="decideToRunStep04" decider="isStepNeededDecider" >
<next on="RUN" to="step04"/>
<!-- Other state is "SKIP" -->
</decision>
<step id="step04">
<!-- Conditionally do something-->
</step>
</flow>
</split>
<step id="step05" >
<!-- Some more stuff -->
</step>
这似乎是 Spring 家伙会想到的事情,所以很好奇实现这一点的正确、非 hack 方法是什么。谢谢。
【问题讨论】:
标签: spring-batch