Class FlowBuilder.SplitBuilder<Q>
- java.lang.Object
- org.springframework.batch.core.job.builder.FlowBuilder.SplitBuilder<Q>
- Type Parameters:
Q
- the result of the parent builder's build()
- Enclosing class:
- FlowBuilder<Q>
public static class FlowBuilder.SplitBuilder<Q> extends java.lang.Object
A builder for building a split state. Example (builder
is aFlowBuilder
):Flow splitFlow = builder.start(flow1).split(new SyncTaskExecutor()).add(flow2).build();
whereflow1
andflow2
will be executed (one after the other because of the task executor that was added). Another exampleFlow splitFlow = builder.start(step1).split(new SimpleAsyncTaskExecutor()).add(flow).build();
In this example, a flow consisting ofstep1
will be executed in parallel withflow
. Note: Adding a split to a chain of states is not supported. For example, the following configuration is not supported. Instead, the configuration would need to create a flow3 that was the split flow and assemble them separately.// instead of this Flow complexFlow = new FlowBuilder<SimpleFlow>("ComplexParallelFlow") .start(flow1) .next(flow2) .split(new SimpleAsyncTaskExecutor()) .add(flow3, flow4) .build(); // do this Flow splitFlow = new FlowBuilder<SimpleFlow>("parallelFlow") .start(flow3) .split(new SimpleAsyncTaskExecutor()) .add(flow4).build(); Flow complexFlow = new FlowBuilder<SimpleFlow>("ComplexParallelFlow") .start(flow1) .next(flow2) .next(splitFlow) .build();
- Author:
- Dave Syer, Michael Minella
Constructor Summary
Constructors Constructor Description SplitBuilder(FlowBuilder<Q> parent, org.springframework.core.task.TaskExecutor executor)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FlowBuilder<Q>
add(Flow... flows)
Add flows to the split, in addition to the current state already present in the parent builder.
Constructor Detail
SplitBuilder
public SplitBuilder(FlowBuilder<Q> parent, org.springframework.core.task.TaskExecutor executor)
- Parameters:
parent
- the parent builderexecutor
- the task executor to use in the split
Method Detail
add
public FlowBuilder<Q> add(Flow... flows)
Add flows to the split, in addition to the current state already present in the parent builder.- Parameters:
flows
- more flows to add to the split- Returns:
- the parent builder