Class RemotePartitioningManagerStepBuilder

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

public class RemotePartitioningManagerStepBuilder extends org.springframework.batch.core.step.builder.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
  • Constructor Details

    • RemotePartitioningManagerStepBuilder

      public RemotePartitioningManagerStepBuilder(String stepName, org.springframework.batch.core.repository.JobRepository jobRepository)
      Parameters:
      stepName - name of the manager step
      jobRepository - job repository to which the step should report to
      Since:
      5.0
  • Method Details

    • 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

      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:
    • 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 org.springframework.batch.core.step.Step build()
      Overrides:
      build in class org.springframework.batch.core.step.builder.PartitionStepBuilder
    • partitioner

      public RemotePartitioningManagerStepBuilder partitioner(String workerStepName, org.springframework.batch.core.partition.Partitioner partitioner)
      Overrides:
      partitioner in class org.springframework.batch.core.step.builder.PartitionStepBuilder
    • gridSize

      public RemotePartitioningManagerStepBuilder gridSize(int gridSize)
      Overrides:
      gridSize in class org.springframework.batch.core.step.builder.PartitionStepBuilder
    • step

      public RemotePartitioningManagerStepBuilder step(org.springframework.batch.core.step.Step step)
      Overrides:
      step in class org.springframework.batch.core.step.builder.PartitionStepBuilder
    • splitter

      public RemotePartitioningManagerStepBuilder splitter(org.springframework.batch.core.partition.StepExecutionSplitter splitter)
      Overrides:
      splitter in class org.springframework.batch.core.step.builder.PartitionStepBuilder
    • aggregator

      public RemotePartitioningManagerStepBuilder aggregator(org.springframework.batch.core.partition.StepExecutionAggregator aggregator)
      Overrides:
      aggregator in class org.springframework.batch.core.step.builder.PartitionStepBuilder
    • startLimit

      public RemotePartitioningManagerStepBuilder startLimit(int startLimit)
      Overrides:
      startLimit in class org.springframework.batch.core.step.builder.StepBuilderHelper<org.springframework.batch.core.step.builder.PartitionStepBuilder>
    • listener

      public RemotePartitioningManagerStepBuilder listener(Object listener)
      Overrides:
      listener in class org.springframework.batch.core.step.builder.StepBuilderHelper<org.springframework.batch.core.step.builder.PartitionStepBuilder>
    • listener

      public RemotePartitioningManagerStepBuilder listener(org.springframework.batch.core.listener.StepExecutionListener listener)
      Overrides:
      listener in class org.springframework.batch.core.step.builder.StepBuilderHelper<org.springframework.batch.core.step.builder.PartitionStepBuilder>
    • allowStartIfComplete

      public RemotePartitioningManagerStepBuilder allowStartIfComplete(boolean allowStartIfComplete)
      Overrides:
      allowStartIfComplete in class org.springframework.batch.core.step.builder.StepBuilderHelper<org.springframework.batch.core.step.builder.PartitionStepBuilder>
    • partitionHandler

      public RemotePartitioningManagerStepBuilder partitionHandler(org.springframework.batch.core.partition.PartitionHandler partitionHandler) throws 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 org.springframework.batch.core.step.builder.PartitionStepBuilder
      Parameters:
      partitionHandler - a partition handler
      Returns:
      this builder instance for fluent chaining
      Throws:
      UnsupportedOperationException - if a partition handler is provided