Question

Is there any suggestions to the way to transfrom this xml config to javaconfig:

<job id="job">
    <step id="step1" >
        <next on="FAILED" to="step2"/>
        <next on="*" to="step3"/> 
    </step>
    <step id="step2"/>
    <step id="step3"next="step4"/>
    <step id="step4"/>
</job>  

I was able to create a job having one step leading to another step on success and to a different one on failure:

SimpleJobBuilder builder = new JobBuilder("job").repository(jobRepository)
.start(step1()).next(step2())
.on("FAILED").to(step3()).build();  
Was it helpful?

Solution

Maybe like this:

jobs.get("job")
    .start(step1())
        .on("FAILED").to(step2())
        .next(step3())
    .from(step1())
        .next(step3())
        .next(step4())
.build().build();

(Step 2 is only executed if step 1 finished with status 'FAILED'. All other steps are executed in order. Is that what you intended?)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top