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: For remote chunking, an example of a configuration class would be:
 @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