Multiple jobs launched in parallel produce database errors #4676
-
I'm having a spring boot application where several quartz triggers call spring batch jobs.
I then used @Bean
public JobLauncher asyncJobLauncher() throws Exception {
TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher();
jobLauncher.setJobRepository(jobRepository);
jobLauncher.setTaskExecutor(new SimpleAsyncTaskExecutor());
jobLauncher.afterPropertiesSet();
return jobLauncher;
} to launch the job and then it works better (I think) but I actually need to wait for the completion and I can't figure out how to do that here. I tried to use a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The default isolation level of transactions on the job repository is |
Beta Was this translation helpful? Give feedback.
Sure you can. However, you should do the retry manually, there is no built-in retry support in the job launcher provided OOTB by Spring Batch. I remember I answered a similar question on StackOverflow with a complete example, here it is: https://stackoverflow.com/a/55137314/5019386.
I will let you close this discussion if you think I answered your question, otherwise let me know if you need more support. I would love to help!