Each step execution can utilize a thread pool to run its readers, writers, and processors. The idea is to implement an asynchronous batch process that can execute independently, instead of each waiting for the previous execution to finish.
Create a separate Maven project that will utilize all components of ch11-batch-sync
with the inclusion of thread pool generation.
Let's implement a non-blocking batch process by following these steps:
- Create a Spring Boot 2.0 project,
ch11-batch-async
, that has the same starter POM dependencies with the same MySQL connection pool support and Spring OXM module. - Create a bootstrap class that enables batch processing and task scheduling:
@EnableBatchProcessing @SpringBootApplication @EnableScheduling public class AsyncBatchBootApplication { public static void main(String[] args) throws Exception { SpringApplication.run(AsyncBatchBootApplication.class, args); } }
- In its...