org.springframework.batch.integration.partition

## Class RemotePartitioningManagerStepBuilder

- java.lang.Object
- - org.springframework.batch.core.step.builder.StepBuilderHelper<PartitionStepBuilder>
  - - org.springframework.batch.core.step.builder.PartitionStepBuilder
    - - org.springframework.batch.integration.partition.RemotePartitioningManagerStepBuilder

-     public class RemotePartitioningManagerStepBuilder
      extends PartitionStepBuilder

  Builder for a manager step in a remote partitioning setup. This builder creates and sets a `MessageChannelPartitionHandler` on the manager step.

  If no `messagingTemplate` is provided through `messagingTemplate(MessagingTemplate)`, this builder will create one and set its default channel to the `outputChannel` provided through `outputChannel(MessageChannel)`.

  If a `messagingTemplate` is provided, it is assumed that it is fully configured and that its default channel is set to an output channel on which requests to workers will be sent.

  Since:
    4.2
  Author:
    Mahmoud Ben Hassine

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.springframework.batch.core.step.builder.StepBuilderHelper

      `StepBuilderHelper.CommonStepProperties`

  - ### Field Summary

    - ### Fields inherited from class org.springframework.batch.core.step.builder.StepBuilderHelper

      `logger, properties`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RemotePartitioningManagerStepBuilder(java.lang.String stepName)` Create a new `RemotePartitioningManagerStepBuilder`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `RemotePartitioningManagerStepBuilder` | `aggregator(StepExecutionAggregator aggregator)` Provide a step execution aggregator for aggregating partitioned step executions into a single result for the `PartitionStep` itself.
    `RemotePartitioningManagerStepBuilder` | `allowStartIfComplete(boolean allowStartIfComplete)`
    `RemotePartitioningManagerStepBuilder` | `beanFactory(org.springframework.beans.factory.BeanFactory beanFactory)` Set the bean factory.
    `Step` | `build()`
    `RemotePartitioningManagerStepBuilder` | `gridSize(int gridSize)` A hint to the `PartitionStepBuilder.splitter(StepExecutionSplitter)` about how many step executions are required.
    `RemotePartitioningManagerStepBuilder` | `inputChannel(org.springframework.messaging.MessageChannel inputChannel)` Set the input channel on which replies from workers will be received.
    `RemotePartitioningManagerStepBuilder` | `jobExplorer(JobExplorer jobExplorer)` Set the job explorer.
    `RemotePartitioningManagerStepBuilder` | `listener(java.lang.Object listener)` Registers objects using the annotation based listener configuration.
    `RemotePartitioningManagerStepBuilder` | `listener(StepExecutionListener listener)`
    `RemotePartitioningManagerStepBuilder` | `messagingTemplate(org.springframework.integration.core.MessagingTemplate messagingTemplate)` Set the `MessagingTemplate` to use to send data to workers.
    `RemotePartitioningManagerStepBuilder` | `outputChannel(org.springframework.messaging.MessageChannel outputChannel)` Set the output channel on which requests to workers will be sent.
    `RemotePartitioningManagerStepBuilder` | `partitioner(java.lang.String workerStepName, Partitioner partitioner)` Add a partitioner which can be used to create a `StepExecutionSplitter`.
    `RemotePartitioningManagerStepBuilder` | `partitionHandler(PartitionHandler partitionHandler)` This method will throw a `UnsupportedOperationException` since the partition handler of the manager step will be automatically set to an instance of `MessageChannelPartitionHandler`.
    `RemotePartitioningManagerStepBuilder` | `pollInterval(long pollInterval)` How often to poll the job repository for the status of the workers.
    `RemotePartitioningManagerStepBuilder` | `repository(JobRepository jobRepository)`
    `RemotePartitioningManagerStepBuilder` | `splitter(StepExecutionSplitter splitter)` Provide an explicit `StepExecutionSplitter` instead of having one build from the `PartitionStepBuilder.partitioner(String, Partitioner)`.
    `RemotePartitioningManagerStepBuilder` | `startLimit(int startLimit)`
    `RemotePartitioningManagerStepBuilder` | `step(Step step)` Provide an actual step instance to execute in parallel.
    `RemotePartitioningManagerStepBuilder` | `timeout(long timeout)` When using job repository polling, the time limit to wait.
    `RemotePartitioningManagerStepBuilder` | `transactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)`

    - ### Methods inherited from class org.springframework.batch.core.step.builder.PartitionStepBuilder

      `getAggregator, getGridSize, getPartitioner, getPartitionHandler, getSplitter, getStep, getStepName, getTaskExecutor, taskExecutor`

    - ### Methods inherited from class org.springframework.batch.core.step.builder.StepBuilderHelper

      `enhance, getJobRepository, getName, getTransactionManager, isAllowStartIfComplete`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RemotePartitioningManagerStepBuilder

          public RemotePartitioningManagerStepBuilder(java.lang.String stepName)

      Create a new `RemotePartitioningManagerStepBuilder`.
      Parameters:
        `stepName` - name of the manager step

  - ### Method Detail

    - #### inputChannel

          public RemotePartitioningManagerStepBuilder inputChannel(org.springframework.messaging.MessageChannel inputChannel)

      Set the input channel on which replies from workers will be received.
      Parameters:
        `inputChannel` - the input channel
      Returns:
        this builder instance for fluent chaining

    - #### outputChannel

          public RemotePartitioningManagerStepBuilder outputChannel(org.springframework.messaging.MessageChannel outputChannel)

      Set the output channel on which requests to workers will be sent. By using this setter, a default messaging template will be created and the output channel will be set as its default channel.

      Use either this setter or `messagingTemplate(MessagingTemplate)` to provide a fully configured messaging template.

      Parameters:
        `outputChannel` - the output channel.
      Returns:
        this builder instance for fluent chaining
      See Also:
        `messagingTemplate(MessagingTemplate)`

    - #### messagingTemplate

          public RemotePartitioningManagerStepBuilder messagingTemplate(org.springframework.integration.core.MessagingTemplate messagingTemplate)

      Set the `MessagingTemplate` to use to send data to workers. The default channel of the messaging template must be set.

      Use either this setter to provide a fully configured messaging template or provide an output channel through `outputChannel(MessageChannel)` and a default messaging template will be created.

      Parameters:
        `messagingTemplate` - the messaging template to use
      Returns:
        this builder instance for fluent chaining
      See Also:
        `outputChannel(MessageChannel)`

    - #### jobExplorer

          public RemotePartitioningManagerStepBuilder jobExplorer(JobExplorer jobExplorer)

      Set the job explorer.
      Parameters:
        `jobExplorer` - the job explorer to use.
      Returns:
        this builder instance for fluent chaining

    - #### pollInterval

          public RemotePartitioningManagerStepBuilder pollInterval(long pollInterval)

      How often to poll the job repository for the status of the workers. Defaults to 10 seconds.
      Parameters:
        `pollInterval` - the poll interval value in milliseconds
      Returns:
        this builder instance for fluent chaining

    - #### timeout

          public RemotePartitioningManagerStepBuilder timeout(long timeout)

      When using job repository polling, the time limit to wait. Defaults to -1 (no timeout).
      Parameters:
        `timeout` - the timeout value in milliseconds
      Returns:
        this builder instance for fluent chaining

    - #### beanFactory

          public RemotePartitioningManagerStepBuilder beanFactory(org.springframework.beans.factory.BeanFactory beanFactory)

      Set the bean factory.
      Parameters:
        `beanFactory` - the bean factory to use
      Returns:
        this builder instance for fluent chaining

    - #### build

          public Step build()

      Overrides:
        `build` in class `PartitionStepBuilder`

    - #### repository

          public RemotePartitioningManagerStepBuilder repository(JobRepository jobRepository)

      Overrides:
        `repository` in class `StepBuilderHelper<PartitionStepBuilder>`

    - #### transactionManager

          public RemotePartitioningManagerStepBuilder transactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)

      Overrides:
        `transactionManager` in class `StepBuilderHelper<PartitionStepBuilder>`

    - #### partitioner

          public RemotePartitioningManagerStepBuilder partitioner(java.lang.String workerStepName,
                                                                  Partitioner partitioner)

      Description copied from class: `PartitionStepBuilder`
      Add a partitioner which can be used to create a `StepExecutionSplitter`. Use either this or an explicit `PartitionStepBuilder.splitter(StepExecutionSplitter)` but not both.
      Overrides:
        `partitioner` in class `PartitionStepBuilder`
      Parameters:
        `workerStepName` - the name of the worker step (used to construct step execution names)
        `partitioner` - a partitioner to use
      Returns:
        this for fluent chaining

    - #### gridSize

          public RemotePartitioningManagerStepBuilder gridSize(int gridSize)

      Description copied from class: `PartitionStepBuilder`
      A hint to the `PartitionStepBuilder.splitter(StepExecutionSplitter)` about how many step executions are required. If running locally or remotely through a `PartitionStepBuilder.taskExecutor(TaskExecutor)` determines precisely the number of step executions in the first attempt at a partition step execution.
      Overrides:
        `gridSize` in class `PartitionStepBuilder`
      Parameters:
        `gridSize` - the grid size
      Returns:
        this for fluent chaining

    - #### step

          public RemotePartitioningManagerStepBuilder step(Step step)

      Description copied from class: `PartitionStepBuilder`
      Provide an actual step instance to execute in parallel. If an explicit `PartitionStepBuilder.partitionHandler(PartitionHandler)` is provided, the step is optional and is only used to extract configuration data (name and other basic properties of a step).
      Overrides:
        `step` in class `PartitionStepBuilder`
      Parameters:
        `step` - a step to execute in parallel
      Returns:
        this for fluent chaining

    - #### splitter

          public RemotePartitioningManagerStepBuilder splitter(StepExecutionSplitter splitter)

      Description copied from class: `PartitionStepBuilder`
      Provide an explicit `StepExecutionSplitter` instead of having one build from the `PartitionStepBuilder.partitioner(String, Partitioner)`. Useful if you need more control over the splitting.
      Overrides:
        `splitter` in class `PartitionStepBuilder`
      Parameters:
        `splitter` - a step execution splitter
      Returns:
        this for fluent chaining

    - #### aggregator

          public RemotePartitioningManagerStepBuilder aggregator(StepExecutionAggregator aggregator)

      Description copied from class: `PartitionStepBuilder`
      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.
      Overrides:
        `aggregator` in class `PartitionStepBuilder`
      Parameters:
        `aggregator` - a step execution aggregator
      Returns:
        this for fluent chaining

    - #### startLimit

          public RemotePartitioningManagerStepBuilder startLimit(int startLimit)

      Overrides:
        `startLimit` in class `StepBuilderHelper<PartitionStepBuilder>`

    - #### listener

          public RemotePartitioningManagerStepBuilder listener(java.lang.Object listener)

      Description copied from class: `StepBuilderHelper`
      Registers objects using the annotation based listener configuration.
      Overrides:
        `listener` in class `StepBuilderHelper<PartitionStepBuilder>`
      Parameters:
        `listener` - the object that has a method configured with listener annotation
      Returns:
        this for fluent chaining

    - #### listener

          public RemotePartitioningManagerStepBuilder listener(StepExecutionListener listener)

      Overrides:
        `listener` in class `StepBuilderHelper<PartitionStepBuilder>`

    - #### allowStartIfComplete

          public RemotePartitioningManagerStepBuilder allowStartIfComplete(boolean allowStartIfComplete)

      Overrides:
        `allowStartIfComplete` in class `StepBuilderHelper<PartitionStepBuilder>`

    - #### partitionHandler

          public RemotePartitioningManagerStepBuilder partitionHandler(PartitionHandler partitionHandler)
                                                                throws java.lang.UnsupportedOperationException

      This method will throw a `UnsupportedOperationException` since the partition handler of the manager step will be automatically set to an instance of `MessageChannelPartitionHandler`. When building a manager step for remote partitioning using this builder, no partition handler must be provided.
      Overrides:
        `partitionHandler` in class `PartitionStepBuilder`
      Parameters:
        `partitionHandler` - a partition handler
      Returns:
        this builder instance for fluent chaining
      Throws:
        `java.lang.UnsupportedOperationException` - if a partition handler is provided
      See Also:
        `for setting up a default handler that works with a local or remote Step`