我有多个cron任务,当一个cron任务在另一个cron任务失败时自动运行
@Scheduled(cron = "${cron.expressiom_report}")
public void runReportCreationJob() throws Exception {
JobParameters jobParameters =
new JobParametersBuilder()
.addLong("time",System.currentTimeMillis()).toJobParameters();
jobLauncher.run(ReportSchedulerConfiguration.job(), jobParameters);
}
@Scheduled(cron = "${cron.expression}")
public void runTicketJob() throws Exception {
JobParameters jobParameters =
new JobParametersBuilder()
.addLong("time",System.currentTimeMillis()).toJobParameters();
jobLauncher.run(firstBatchConfiguration.job(), jobParameters);
@Bean(value = "Notify")
public Job job() {
return jobBuilderFactorySla.get("Notify").incrementer(new RunIdIncrementer()).flow(step2()).end()
.build();
}
@Bean
public Step step2() {
return stepBuilderFactorySla.get("step2").tasklet(notify_alert()).build();
}