Skip to content

Workflow ES 2.2

Compare
Choose a tag to compare
@danielgerlag danielgerlag released this 25 Mar 22:06
· 39 commits to master since this release
63faf7e

Workflow ES 2.2

Parallel Sequences

Run several sequences of steps in parallel

class Parallel_Workflow {
    
    build(builder) {
        builder
        .startWith(SayHello)
        .parallel()
            .do(branch1 => branch1
                .startWith(PrintMessage)
                    .input((step, data) => step.message = "Running in branch 1")
                .delay(data => 5000)
                .then(DoSomething)
            )
            .do(branch2 => branch2
                .startWith(PrintMessage)
                    .input((step, data) => step.message = "Running in branch 2")
            )
            .do(branch3 => branch3
                .startWith(PrintMessage)
                    .input((step, data) => step.message = "Running in branch 3")
            )
        .join()
        .then(SayGoodbye);
    }
}