1、顺序执行step:

spring batch中控制step的走向

<job id="job">
    <step id="stepA" parent="s1" next="stepB" />
    <step id="stepB" parent="s2" next="stepC"/>
    <step id="stepC" parent="s3" />
</job>

2、分支执行:

spring batch中控制step的走向

<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" />
    <step id="stepC" parent="s3" />
</job>

当用xml配置文件的时候,on属性可以使用通配符来表达step的返回状态。目前,只支持两种符号:*和?。

  • "*" 匹配0个或者多个字符

  • "?" 只能匹配1个字符

比如, "c*t"匹配"cat"和"count",但是"c?t"只能匹配"cat",不能匹配 "count"。

3、BatchStatus VS ExitStatus

1)BatchStatus是一个enum类型,包括:

COMPLETED, STARTING, STARTED, STOPPING, STOPPED, FAILED, ABANDONED, UNKNOWN

而ExitStatus是一个普通类,可以是任意返回值,主要有以下几个:

UNKNOWN,EXECUTING,COMPLETED,NOOP,FAILED,STOPPED

2)当用xml配置文件的时候,next元素表示的是ExitStatus

3)当用java代码的时候,on方法表示的还是ExitStatus

 

 

相关文章:

  • 2022-12-23
  • 2022-01-11
  • 2021-06-23
  • 2021-05-31
  • 2021-06-16
猜你喜欢
  • 2021-08-09
  • 2022-01-15
  • 2021-11-19
  • 2021-11-13
  • 2021-05-15
  • 2021-09-06
相关资源
相似解决方案