Spring batch spring批处理步骤未在计划中重新启动
我有两份工作,在如下工作中声明:Spring batch spring批处理步骤未在计划中重新启动,spring-batch,Spring Batch,我有两份工作,在如下工作中声明: @Bean Job job1(JobBuilderFactory jobBuilderFactory, @Qualifier("step1") Step step1, @Qualifier("step2") Step step2) { return jobBuilderFactory.get("job1")
@Bean
Job job1(JobBuilderFactory jobBuilderFactory,
@Qualifier("step1") Step step1, @Qualifier("step2") Step step2) {
return jobBuilderFactory.get("job1")
.incrementer(new RunIdIncrementer())
.start(step1)
.next(step2)
.build();
}
public BatchStatus run() throws JobParametersInvalidException, JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException {
JobParameters parameters = new JobParametersBuilder().addLong("time", System.currentTimeMillis()).toJobParameters();
JobExecution jobExecution = jobLauncher.run(job, parameters);
return jobExecution.getStatus();
}
我的午餐工作如下:
@Bean
Job job1(JobBuilderFactory jobBuilderFactory,
@Qualifier("step1") Step step1, @Qualifier("step2") Step step2) {
return jobBuilderFactory.get("job1")
.incrementer(new RunIdIncrementer())
.start(step1)
.next(step2)
.build();
}
public BatchStatus run() throws JobParametersInvalidException, JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException {
JobParameters parameters = new JobParametersBuilder().addLong("time", System.currentTimeMillis()).toJobParameters();
JobExecution jobExecution = jobLauncher.run(job, parameters);
return jobExecution.getStatus();
}
最后,我的计划是:
@Autowired
private BatchLauncher batchLauncher;
@Scheduled(fixedDelay = 10000)
public void perform() throws Exception {
batchLauncher.run();
}
在第一次执行中,一切正常,但从我得到的日志中的第二次执行开始
2020-11-16 09:22:25.934 INFO 45432 --- [ scheduling-1] o.s.b.c.l.support.SimpleJobLauncher : Job: [FlowJob: [name=factureJob]] launched with the following parameters: [{time=1605514945934}]
2020-11-16 09:22:25.934 INFO 45432 --- [ scheduling-1] o.s.batch.core.job.SimpleStepHandler : Executing step: [step1]
2020-11-16 09:22:25.934 INFO 45432 --- [ scheduling-1] o.s.batch.core.step.AbstractStep : Step: [step1] executed in
2020-11-16 09:22:25.934 INFO 45432 --- [ scheduling-1] o.s.batch.core.job.SimpleStepHandler : Executing step: [step2]
2020-11-16 09:22:25.934 INFO 45432 --- [ scheduling-1] o.s.batch.core.step.AbstractStep : Step: [step2] executed in
2020-11-16 09:22:25.934 INFO 45432 --- [ scheduling-1] o.s.b.c.l.support.SimpleJobLauncher : Job: [FlowJob: [name=job1]] completed with the following parameters: [{time=1605514945934}] and the following status: [COMPLETED] in
Process finished with exit code -1
但是我的步骤没有执行,我看不到我在里面做的任何日志,我不知道我在这里遗漏了什么,你能帮我吗。
多谢各位