大家好,又见面了,我是你们的朋友全栈君。
– Start
点击此处观看本系列配套视频。
顺序流程(Sequential Flow)
<job id="job">
<step id="stepA" parent="s1" next="stepB" />
<step id="stepB" parent="s2" next="stepC"/>
<step id="stepC" parent="s3" />
</job>
条件流程(Conditional Flow)
<job id="job">
<step id="stepA" parent="s1">
<next on="*" to="stepB" />
<next on="FAILED" to="stepC" />
</step>
<step id="stepB" parent="s2" next="stepC">
<fail on="FAILED" exit-code="EARLY TERMINATION"/>
</step>
<step id="stepC" parent="s3">
<stop on="COMPLETED"/>
<end on="FAILED"/>
</step>
</job>
自定义流程(Programmatic Flow Decisions)
首先,继承 JobExecutionDecider,自定义流程.
public class MyDecider implements JobExecutionDecider {
public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) {
if (someCondition) {
return "FAILED";
}
else {
return "COMPLETED";
}
}
}
然后就可以使用这个流程了。
<job id="job">
<step id="step1" parent="s1" next="decision" />
<decision id="decision" decider="decider">
<next on="FAILED" to="step2" />
<next on="COMPLETED" to="step3" />
</decision>
<step id="step2" parent="s2" next="step3"/>
<step id="step3" parent="s3" />
</job>
<beans:bean id="decider" class="com.MyDecider"/>
并行流程(Split Flow)
<split id="split1" next="step4">
<flow>
<step id="step1" parent="s1" next="step2"/>
<step id="step2" parent="s2"/>
</flow>
<flow>
<step id="step3" parent="s3"/>
</flow>
</split>
<step id="step4" parent="s4"/>
– 更多参见:Spring Batch 精萃
– 声 明:转载请注明出处
– Last Updated on 2017-07-24
– Written by ShangBo on 2017-07-24
– End
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/145022.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...