Step1: Download spring-boot-batch-multi-jobs project
https://github.com/making/spring-boot-batch-multi-jobs
Add following details to pom.xml:
$ ./mvnw clean package -DskipTests=true
Run all jobs
$ java -jar target/spring-boot-batch-multi-jobs-0.0.1.RELEASE.jar
Run only specified jobs
Only job1
$ java -jar target/spring-boot-batch-multi-jobs-0.0.1.RELEASE.jar --spring.batch.job.names=job1
Only job2
$ java -jar target/spring-boot-batch-multi-jobs-0.0.1.RELEASE.jar --spring.batch.job.names=job2
job1 and job2
$ java -jar target/spring-boot-batch-multi-jobs-0.0.1.RELEASE.jar --spring.batch.job.names=job1,job2
References:
https://docs.spring.io/spring-batch/4.0.x/reference/html/domain.html#domainLanguageOfBatch
https://stackoverflow.com/questions/45718888/spring-batch-running-multiple-jobs-in-parallel
https://docs.spring.io/spring-javaconfig/docs/1.0.0.M4/reference/html/ch02s02.html
https://docs.spring.io/autorepo/docs/spring/4.1.4.RELEASE/javadoc-api/org/springframework/core/task/SimpleAsyncTaskExecutor.html
https://docs.spring.io/spring-boot/docs/current/reference/html/howto-batch-applications.html
https://github.com/making/spring-boot-batch-multi-jobs
Add following details to pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
</dependency>
$ ./mvnw clean package -DskipTests=true
Run all jobs
$ java -jar target/spring-boot-batch-multi-jobs-0.0.1.RELEASE.jar
Run only specified jobs
Only job1
$ java -jar target/spring-boot-batch-multi-jobs-0.0.1.RELEASE.jar --spring.batch.job.names=job1
Only job2
$ java -jar target/spring-boot-batch-multi-jobs-0.0.1.RELEASE.jar --spring.batch.job.names=job2
job1 and job2
$ java -jar target/spring-boot-batch-multi-jobs-0.0.1.RELEASE.jar --spring.batch.job.names=job1,job2
References:
https://docs.spring.io/spring-batch/4.0.x/reference/html/domain.html#domainLanguageOfBatch
https://stackoverflow.com/questions/45718888/spring-batch-running-multiple-jobs-in-parallel
https://docs.spring.io/spring-javaconfig/docs/1.0.0.M4/reference/html/ch02s02.html
https://docs.spring.io/autorepo/docs/spring/4.1.4.RELEASE/javadoc-api/org/springframework/core/task/SimpleAsyncTaskExecutor.html
https://docs.spring.io/spring-boot/docs/current/reference/html/howto-batch-applications.html
No comments:
Post a Comment