Class RemotePartitioningWorkerStepBuilder
- java.lang.Object
- org.springframework.batch.core.step.builder.StepBuilderHelper<StepBuilder>
- org.springframework.batch.core.step.builder.StepBuilder
- org.springframework.batch.integration.partition.RemotePartitioningWorkerStepBuilder
public class RemotePartitioningWorkerStepBuilder extends StepBuilder
Builder for a worker step in a remote partitioning setup. This builder creates anIntegrationFlowthat:- listens to
StepExecutionRequests coming from the master on the input channel - invokes the
StepExecutionRequestHandlerto execute the worker step for each incoming request. The worker step is located using the providedStepLocator. If noStepLocatoris provided, aBeanFactoryStepLocatorconfigured with the currentBeanFactorywill be used - replies to the master on the output channel (when the master step is configured to aggregate replies from workers). If no output channel is provided, a
NullChannelwill be used (assuming the master side is configured to poll the job repository for workers status)
- Since:
- 4.1
- Author:
- Mahmoud Ben Hassine
- listens to
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
properties
Constructor Summary
Constructors Constructor Description RemotePartitioningWorkerStepBuilder(java.lang.String name)Initialize a step builder for a step with the given name.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RemotePartitioningWorkerStepBuilderallowStartIfComplete(boolean allowStartIfComplete)RemotePartitioningWorkerStepBuilderbeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)Set the bean factory.<I,O>
SimpleStepBuilder<I,O>chunk(int chunkSize)Build a step that processes items in chunks with the size provided.<I,O>
SimpleStepBuilder<I,O>chunk(CompletionPolicy completionPolicy)Build a step that processes items in chunks with the completion policy provided.FlowStepBuilderflow(Flow flow)Create a new step builder that will execute a flow.RemotePartitioningWorkerStepBuilderinputChannel(org.springframework.messaging.MessageChannel inputChannel)Set the input channel on which step execution requests sent by the master are received.JobStepBuilderjob(Job job)Create a new step builder that will execute a job.RemotePartitioningWorkerStepBuilderjobExplorer(JobExplorer jobExplorer)Set the job explorer.RemotePartitioningWorkerStepBuilderlistener(java.lang.Object listener)Registers objects using the annotation based listener configuration.RemotePartitioningWorkerStepBuilderlistener(StepExecutionListener listener)RemotePartitioningWorkerStepBuilderoutputChannel(org.springframework.messaging.MessageChannel outputChannel)Set the output channel on which replies will be sent to the master step.PartitionStepBuilderpartitioner(java.lang.String stepName, Partitioner partitioner)Create a partition step builder for a remote (or local) step.PartitionStepBuilderpartitioner(Step step)Create a partition step builder for a remote (or local) step.RemotePartitioningWorkerStepBuilderrepository(JobRepository jobRepository)RemotePartitioningWorkerStepBuilderstartLimit(int startLimit)RemotePartitioningWorkerStepBuilderstepLocator(StepLocator stepLocator)Set the step locator used to locate the worker step to execute.TaskletStepBuildertasklet(Tasklet tasklet)Build a step with a custom tasklet, not necessarily item processing.RemotePartitioningWorkerStepBuildertransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)Methods inherited from class org.springframework.batch.core.step.builder.StepBuilderHelper
enhance, getJobRepository, getName, getTransactionManager, isAllowStartIfComplete
Method Detail
inputChannel
public RemotePartitioningWorkerStepBuilder inputChannel(org.springframework.messaging.MessageChannel inputChannel)
Set the input channel on which step execution requests sent by the master are received.- Parameters:
inputChannel- the input channel- Returns:
- this builder instance for fluent chaining
outputChannel
public RemotePartitioningWorkerStepBuilder outputChannel(org.springframework.messaging.MessageChannel outputChannel)
Set the output channel on which replies will be sent to the master step.- Parameters:
outputChannel- the input channel- Returns:
- this builder instance for fluent chaining
jobExplorer
public RemotePartitioningWorkerStepBuilder jobExplorer(JobExplorer jobExplorer)
Set the job explorer.- Parameters:
jobExplorer- the job explorer to use- Returns:
- this builder instance for fluent chaining
stepLocator
public RemotePartitioningWorkerStepBuilder stepLocator(StepLocator stepLocator)
Set the step locator used to locate the worker step to execute.- Parameters:
stepLocator- the step locator to use- Returns:
- this builder instance for fluent chaining
beanFactory
public RemotePartitioningWorkerStepBuilder beanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Set the bean factory.- Parameters:
beanFactory- the bean factory- Returns:
- this builder instance for fluent chaining
repository
public RemotePartitioningWorkerStepBuilder repository(JobRepository jobRepository)
- Overrides:
repositoryin classStepBuilderHelper<StepBuilder>
transactionManager
public RemotePartitioningWorkerStepBuilder transactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
- Overrides:
transactionManagerin classStepBuilderHelper<StepBuilder>
startLimit
public RemotePartitioningWorkerStepBuilder startLimit(int startLimit)
- Overrides:
startLimitin classStepBuilderHelper<StepBuilder>
listener
public RemotePartitioningWorkerStepBuilder listener(java.lang.Object listener)
Description copied from class:StepBuilderHelperRegisters objects using the annotation based listener configuration.- Overrides:
listenerin classStepBuilderHelper<StepBuilder>- Parameters:
listener- the object that has a method configured with listener annotation- Returns:
- this for fluent chaining
listener
public RemotePartitioningWorkerStepBuilder listener(StepExecutionListener listener)
- Overrides:
listenerin classStepBuilderHelper<StepBuilder>
allowStartIfComplete
public RemotePartitioningWorkerStepBuilder allowStartIfComplete(boolean allowStartIfComplete)
- Overrides:
allowStartIfCompletein classStepBuilderHelper<StepBuilder>
tasklet
public TaskletStepBuilder tasklet(Tasklet tasklet)
Description copied from class:StepBuilderBuild a step with a custom tasklet, not necessarily item processing.- Overrides:
taskletin classStepBuilder- Parameters:
tasklet- a tasklet- Returns:
- a
TaskletStepBuilder
chunk
public <I,O> SimpleStepBuilder<I,O> chunk(int chunkSize)
Description copied from class:StepBuilderBuild a step that processes items in chunks with the size provided. To extend the step to being fault tolerant, call theSimpleStepBuilder.faultTolerant()method on the builder. In most cases you will want to parameterize your call to this method, to preserve the type safety of your readers and writers, e.g.new StepBuilder("step1").<Order, Ledger> chunk(100).reader(new OrderReader()).writer(new LedgerWriter()) // ... etc.- Overrides:
chunkin classStepBuilder- Type Parameters:
I- the type of item to be processed as inputO- the type of item to be output- Parameters:
chunkSize- the chunk size (commit interval)- Returns:
- a
SimpleStepBuilder
chunk
public <I,O> SimpleStepBuilder<I,O> chunk(CompletionPolicy completionPolicy)
Description copied from class:StepBuilderBuild a step that processes items in chunks with the completion policy provided. To extend the step to being fault tolerant, call theSimpleStepBuilder.faultTolerant()method on the builder. In most cases you will want to parameterize your call to this method, to preserve the type safety of your readers and writers, e.g.new StepBuilder("step1").<Order, Ledger> chunk(100).reader(new OrderReader()).writer(new LedgerWriter()) // ... etc.- Overrides:
chunkin classStepBuilder- Type Parameters:
I- the type of item to be processed as inputO- the type of item to be output *- Parameters:
completionPolicy- the completion policy to use to control chunk processing- Returns:
- a
SimpleStepBuilder
partitioner
public PartitionStepBuilder partitioner(java.lang.String stepName, Partitioner partitioner)
Description copied from class:StepBuilderCreate a partition step builder for a remote (or local) step.- Overrides:
partitionerin classStepBuilder- Parameters:
stepName- the name of the remote or delegate steppartitioner- a partitioner to be used to construct new step executions- Returns:
- a
PartitionStepBuilder
partitioner
public PartitionStepBuilder partitioner(Step step)
Description copied from class:StepBuilderCreate a partition step builder for a remote (or local) step.- Overrides:
partitionerin classStepBuilder- Parameters:
step- the step to execute in parallel- Returns:
- a PartitionStepBuilder
job
public JobStepBuilder job(Job job)
Description copied from class:StepBuilderCreate a new step builder that will execute a job.- Overrides:
jobin classStepBuilder- Parameters:
job- a job to execute- Returns:
- a
JobStepBuilder
flow
public FlowStepBuilder flow(Flow flow)
Description copied from class:StepBuilderCreate a new step builder that will execute a flow.- Overrides:
flowin classStepBuilder- Parameters:
flow- a flow to execute- Returns:
- a
FlowStepBuilder