Annotation Interface EnableBatchIntegration
@Target(TYPE)
@Retention(RUNTIME)
@Documented
@EnableIntegration
@Import(BatchIntegrationConfiguration.class)
public @interface EnableBatchIntegration
Enable Spring Batch Integration features and provide a base configuration for
setting up remote chunking or partitioning infrastructure beans.
By adding this annotation on a
Configuration
class, it will be possible to autowire the following beans:
RemoteChunkingManagerStepBuilderFactory
: used to create a manager step of a remote chunking setup by automatically setting the job repository and transaction manager.RemoteChunkingWorkerBuilder
: used to create the integration flow on the worker side of a remote chunking setup.RemotePartitioningManagerStepBuilderFactory
: used to create a manager step of a remote partitioning setup by automatically setting the job repository, job explorer, bean factory and transaction manager.RemotePartitioningWorkerStepBuilderFactory
: used to create a worker step of a remote partitioning setup by automatically setting the job repository, job explorer, bean factory and transaction manager.
@Configuration @EnableBatchIntegration @EnableBatchProcessing public class RemoteChunkingAppConfig { @Autowired private RemoteChunkingManagerStepBuilderFactory managerStepBuilderFactory; @Autowired private RemoteChunkingWorkerBuilder workerBuilder; @Bean public TaskletStep managerStep() { return this.managerStepBuilderFactory .get("managerStep") .chunk(100) .reader(itemReader()) .outputChannel(outgoingRequestsToWorkers()) .inputChannel(incomingRepliesFromWorkers()) .build(); } @Bean public IntegrationFlow worker() { return this.workerBuilder .itemProcessor(itemProcessor()) .itemWriter(itemWriter()) .inputChannel(incomingRequestsFromManager()) .outputChannel(outgoingRepliesToManager()) .build(); } // Middleware beans omitted }For remote partitioning, an example of a configuration class would be:
@Configuration @EnableBatchIntegration @EnableBatchProcessing public class RemotePartitioningAppConfig { @Autowired private RemotePartitioningManagerStepBuilderFactory managerStepBuilderFactory; @Autowired private RemotePartitioningWorkerStepBuilderFactory workerStepBuilderFactory; @Bean public Step managerStep() { return this.managerStepBuilderFactory .get("managerStep") .partitioner("workerStep", partitioner()) .gridSize(10) .outputChannel(outgoingRequestsToWorkers()) .inputChannel(incomingRepliesFromWorkers()) .build(); } @Bean public Step workerStep() { return this.workerStepBuilderFactory .get("workerStep") .inputChannel(incomingRequestsFromManager()) .outputChannel(outgoingRepliesToManager()) .chunk(100) .reader(itemReader()) .processor(itemProcessor()) .writer(itemWriter()) .build(); } // Middleware beans omitted }
- Since:
- 4.1
- Author:
- Mahmoud Ben Hassine