如何使用Spring Batch并行步骤拆分流程配置上述用例? [英] How to configure mentioned use case using spring batch parallel step split flow?

查看:172
本文介绍了如何使用Spring Batch并行步骤拆分流程配置上述用例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要实现此用例,我有3个流程,

I want to implement this use case, I have 3 flows,

<split id="split1" task-executor="taskExecutor">
    <flow>
        <step id="step1" parent="s1" next="step2"/>
        <step id="step2" parent="s2"/>
    </flow>
    <flow>
        <step id="step3" parent="s3"/>
    </flow>
    <flow>
        <step id="step4" parent="s4"/>
    </flow>
    <flow>
        <step id="step5" parent="s5"/>
    </flow>
</split>


<split id="split2" task-executor="taskExecutor">
    <flow>
        <step id="step6" parent="s6"/>
        <step id="step7" parent="s7"/>
    </flow>
    <flow>
        <step id="step8" parent="s8"/>
    </flow>
</split>

<split id="split3" task-executor="taskExecutor">
    <flow>
        <step id="step9" parent="s9"/>
        <step id="step10" parent="s10"/>
        <split id="split3_1" task-executor="taskExecutor">
             <flow>
                 <step id="step11" parent="s11"/>
             </flow>
            <flow>
                  <step id="step12" parent="s12"/>
             </flow>
        </split>
    </flow>
</split>

在split1中,有4个流应并行运行.一旦step2和step3完成,它应该触发split2运行,并且不应该等待split1中的step4和step5.

In split1, there are 4 flows, which should run in parallel. Once step2 and step3 are completed, it should trigger split2 to run and should not wait for step4 and step5 in split1.

同样,如果步骤4和步骤5已完成,则它应触发split3的执行,而无需等待步骤2和步骤3完成.

Similarly, if step4 and step 5 are completed, it should trigger the executio of split3 without waiting for step2 and step3 to finish.

还可以添加步骤并在流程下拆分在一起,例如在上面的split3中,我要强制运行step9和step10,然后并行运行step11和step12.

Also is it possible to add steps and split under flow together e.g. in above split3 I want step9 and step10 to be compulsorily run and then run step11 and step12 in parallel.

如何配置此用例?拆分可以嵌套吗?

How can I configure this use case ? Can splits be nested ?

推荐答案

我将首先尝试以下操作:

I would first try something like the following:

<split id="split1" task-executor="taskExecutor">
    <flow>
        <split next="split2">
            <flow>
                <step id="step1" parent="s1" next="step2"/>
                <step id="step2" parent="s2"/>
            </flow>
            <flow>
                <step id="step3" parent="s3"/>
            </flow>
        </split>

        <split id="split2" task-executor="taskExecutor">
            <flow>
                <step id="step6" parent="s6"/>
                <step id="step7" parent="s7"/>
            </flow>
            <flow>
                <step id="step8" parent="s8"/>
            </flow>
        </split>
    </flow>

    <flow>
        <split next="split3" task-executor="taskExecutor">
            <flow>
                <step id="step4" parent="s4"/>
            </flow>
            <flow>
                <step id="step5" parent="s5"/>
            </flow>
        </split>

        <split id="split3" task-executor="taskExecutor">
            <flow>
                <step id="step9" parent="s9"/>
                <step id="step10" parent="s10"/>
            </flow>
            <flow>
                <step id="step11" parent="s11"/>
            </flow>
        </split>
    </flow>
</split>

,但请确保 Spring Batch版本在2.1.5之后.

but making sure the Spring Batch version is after 2.1.5.

这篇关于如何使用Spring Batch并行步骤拆分流程配置上述用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆