Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between step sequence and flow in spring batch configuration?

I was reading spring io document.

the document shows two different examples

5.3.1 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>

and

5.3.6 Externalizing Flow Definitions and Dependencies Between Jobs

<job id="job">
    <flow id="job1.flow1" parent="flow1" next="step3"/>
    <step id="step3" parent="s3"/>
</job>

<flow id="flow1">
    <step id="step1" parent="s1" next="step2"/>
    <step id="step2" parent="s2"/>
</flow>

what's the difference between using some steps and some flows having some steps?

I'm in confusion. Please help me.

like image 324
Dongin Min Avatar asked Jan 13 '15 06:01

Dongin Min


1 Answers

The second form allow you to reuse flow1 in another job.

<job id="job2">
    <flow id="job2.flow1" parent="flow1" next="job2.step3"/>
    <step id="job2.step3" parent="s3"/>
</job>

From official doc:

The effect of defining an external flow like this is simply to insert the steps from the external flow into the job as if they had been declared inline. In this way many jobs can refer to the same template flow and compose such templates into different logical flows. This is also a good way to separate the integration testing of the individual flows

like image 179
Luca Basso Ricci Avatar answered Oct 02 '22 08:10

Luca Basso Ricci