shardingsphere-elasticjob
shardingsphere-elasticjob copied to clipboard
服务重启后,动态添加定时任务不会执行,如何解决
/*** * 动态创建定时任务 * @param jobName:定时任务名称 * @param cron:表达式 * @param shardingTotalCount:分片数量 * @param instance:定时任务实例 * @param parameters:参数 */ public void create(String jobName, String cron, int shardingTotalCount, SimpleJob instance, String parameters){ JobConfiguration jobConfig = JobConfiguration.newBuilder(jobName, shardingTotalCount) .cron(cron) .failover(true) .overwrite(true) .jobParameter(parameters) .monitorExecution(true) .misfire(true).build();
//启动分布式定时任务
new ScheduleJobBootstrap(registryCenter, new DynamicJob(), jobConfig).schedule();
}
应用重启之后,应用中就没有这些作业了。
您好,我已收到您的邮件,我会尽快回复~
应用重启之后,应用中就没有这些作业了。
对,重启后需要重新加载定时任务
- It looks like the issue author has already been answered. Close the issue.