public class PartitionStepBuilder extends StepBuilderHelper<PartitionStepBuilder>
PartitionStep
instances. A partition step executes the same step (possibly remotely)
multiple times with different input parameters (in the form of execution context). Useful for parallelization.StepBuilderHelper.CommonStepProperties
logger, properties
Constructor and Description |
---|
PartitionStepBuilder(StepBuilderHelper<?> parent)
Create a new builder initialized with any properties in the parent.
|
Modifier and Type | Method and Description |
---|---|
PartitionStepBuilder |
aggregator(StepExecutionAggregator aggregator)
Provide a step execution aggregator for aggregating partitioned step executions into a single result for the
PartitionStep itself. |
Step |
build() |
protected StepExecutionAggregator |
getAggregator() |
protected int |
getGridSize() |
protected Partitioner |
getPartitioner() |
protected PartitionHandler |
getPartitionHandler() |
protected StepExecutionSplitter |
getSplitter() |
protected Step |
getStep() |
protected java.lang.String |
getStepName() |
protected org.springframework.core.task.TaskExecutor |
getTaskExecutor() |
PartitionStepBuilder |
gridSize(int gridSize)
A hint to the
splitter(StepExecutionSplitter) about how many step executions are required. |
PartitionStepBuilder |
partitioner(java.lang.String workerStepName,
Partitioner partitioner)
Add a partitioner which can be used to create a
StepExecutionSplitter . |
PartitionStepBuilder |
partitionHandler(PartitionHandler partitionHandler)
Provide an explicit partition handler that will carry out the work of the partition step.
|
PartitionStepBuilder |
splitter(StepExecutionSplitter splitter)
Provide an explicit
StepExecutionSplitter instead of having one build from the
partitioner(String, Partitioner) . |
PartitionStepBuilder |
step(Step step)
Provide an actual step instance to execute in parallel.
|
PartitionStepBuilder |
taskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Provide a task executor to use when constructing a
PartitionHandler from the step(Step) . |
allowStartIfComplete, enhance, getJobRepository, getName, getTransactionManager, isAllowStartIfComplete, listener, listener, repository, startLimit, transactionManager
public PartitionStepBuilder(StepBuilderHelper<?> parent)
parent
- a parent helper containing common step propertiespublic PartitionStepBuilder partitioner(java.lang.String workerStepName, Partitioner partitioner)
StepExecutionSplitter
. Use either this or an explicit
splitter(StepExecutionSplitter)
but not both.workerStepName
- the name of the worker step (used to construct step execution names)partitioner
- a partitioner to usepublic PartitionStepBuilder step(Step step)
partitionHandler(PartitionHandler)
is provided, the step is optional and is only used to extract
configuration data (name and other basic properties of a step).step
- a step to execute in parallelpublic PartitionStepBuilder taskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
PartitionHandler
from the step(Step)
. Mainly
used for running a step locally in parallel, but can be used to execute remotely if the step is remote. Not used
if an explicit partitionHandler(PartitionHandler)
is provided.taskExecutor
- a task executor to use when executing steps in parallelpublic PartitionStepBuilder partitionHandler(PartitionHandler partitionHandler)
partitionHandler
- a partition handlerfor setting up a default handler that works with a local or remote Step
public PartitionStepBuilder gridSize(int gridSize)
splitter(StepExecutionSplitter)
about how many step executions are required. If running
locally or remotely through a taskExecutor(TaskExecutor)
determines precisely the number of step
executions in the first attempt at a partition step execution.gridSize
- the grid sizepublic PartitionStepBuilder splitter(StepExecutionSplitter splitter)
StepExecutionSplitter
instead of having one build from the
partitioner(String, Partitioner)
. Useful if you need more control over the splitting.splitter
- a step execution splitterpublic PartitionStepBuilder aggregator(StepExecutionAggregator aggregator)
PartitionStep
itself. Default is a simple implementation that works in most cases.aggregator
- a step execution aggregatorpublic Step build()
protected org.springframework.core.task.TaskExecutor getTaskExecutor()
protected Partitioner getPartitioner()
protected Step getStep()
protected PartitionHandler getPartitionHandler()
protected int getGridSize()
protected StepExecutionSplitter getSplitter()
protected StepExecutionAggregator getAggregator()
protected java.lang.String getStepName()