Class PartitionStepBuilder

Direct Known Subclasses:

public class PartitionStepBuilder extends StepBuilderHelper<PartitionStepBuilder>
Step builder for 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.
Dave Syer, Mahmoud Ben Hassine, Dimitrios Liapis
  • Constructor Details

    • PartitionStepBuilder

      public PartitionStepBuilder(StepBuilderHelper<?> parent)
      Create a new builder initialized with any properties in the parent. The parent is copied, so it can be re-used.
      parent - a parent helper containing common step properties
  • Method Details

    • partitioner

      public PartitionStepBuilder partitioner(String workerStepName, Partitioner partitioner)
      Add a partitioner which can be used to create a 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 use
      this for fluent chaining
    • step

      public PartitionStepBuilder step(Step step)
      Provide an actual step instance to execute in parallel. If an explicit 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 parallel
      this for fluent chaining
    • taskExecutor

      public PartitionStepBuilder taskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
      Provide a task executor to use when constructing a 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 parallel
      this for fluent chaining
    • partitionHandler

      public PartitionStepBuilder partitionHandler(PartitionHandler partitionHandler)
      Provide an explicit partition handler that will carry out the work of the partition step. The partition handler is the main SPI for adapting a partition step to a specific distributed computation environment. Optional if you only need local or remote processing through the Step interface.
      partitionHandler - a partition handler
      this for fluent chaining
      See Also:
    • gridSize

      public PartitionStepBuilder gridSize(int gridSize)
      A hint to the 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 size
      this for fluent chaining
    • splitter

      public PartitionStepBuilder splitter(StepExecutionSplitter splitter)
      Provide an explicit StepExecutionSplitter instead of having one build from the partitioner(String, Partitioner). Useful if you need more control over the splitting.
      splitter - a step execution splitter
      this for fluent chaining
    • aggregator

      public PartitionStepBuilder aggregator(StepExecutionAggregator aggregator)
      Provide a step execution aggregator for aggregating partitioned step executions into a single result for the PartitionStep itself. Default is a simple implementation that works in most cases.
      aggregator - a step execution aggregator
      this for fluent chaining
    • build

      public Step build()
    • self

      protected PartitionStepBuilder self()
      Specified by:
      self in class StepBuilderHelper<PartitionStepBuilder>
    • getTaskExecutor

      protected org.springframework.core.task.TaskExecutor getTaskExecutor()
    • getPartitioner

      protected Partitioner getPartitioner()
    • getStep

      protected Step getStep()
    • getPartitionHandler

      protected PartitionHandler getPartitionHandler()
    • getGridSize

      protected int getGridSize()
    • getSplitter

      protected StepExecutionSplitter getSplitter()
    • getAggregator

      protected StepExecutionAggregator getAggregator()
    • getStepName

      protected String getStepName()