事件调度:系统支持Cron、子任务触发、事件触发(API)三种方式触发任务调度;
This commit is contained in:
parent
03979398f1
commit
aef9ef6c66
|
@ -992,6 +992,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
|
|||
- 7、执行器注册线程销毁时, 主动摘除注册机器信息,提高执行器注册的实时性;
|
||||
- 8、调度中心任务监控线程销毁时,批量对失败任务告警,防止告警信息丢失;
|
||||
- 9、调度中心API服务:支持API方式触发任务执行;
|
||||
- 10、事件调度:系统支持Cron、子任务触发、事件触发(API)三种方式触发任务调度;
|
||||
|
||||
### TODO LIST
|
||||
- 1、任务权限管理:执行器为粒度分配权限,核心操作校验权限;
|
||||
|
|
|
@ -34,6 +34,10 @@ public class XxlJobTrigger {
|
|||
|
||||
// load data
|
||||
XxlJobInfo jobInfo = XxlJobDynamicScheduler.xxlJobInfoDao.loadById(jobId); // job info
|
||||
if (jobInfo == null) {
|
||||
logger.warn(">>>>>>>>>>>> xxl-job trigger fail, jobId invalid,jobId={}", jobId);
|
||||
return;
|
||||
}
|
||||
XxlJobGroup group = XxlJobDynamicScheduler.xxlJobGroupDao.load(jobInfo.getJobGroup()); // group info
|
||||
|
||||
ExecutorBlockStrategyEnum blockStrategy = ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), ExecutorBlockStrategyEnum.SERIAL_EXECUTION); // block strategy
|
||||
|
|
|
@ -69,21 +69,10 @@ public class AdminBizImpl implements AdminBiz {
|
|||
for (int i = 0; i < childJobKeys.length; i++) {
|
||||
String[] jobKeyArr = childJobKeys[i].split("_");
|
||||
if (jobKeyArr!=null && jobKeyArr.length==2) {
|
||||
XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.valueOf(jobKeyArr[1]));
|
||||
if (childJobInfo!=null) {
|
||||
try {
|
||||
boolean ret = XxlJobDynamicScheduler.triggerJob(String.valueOf(childJobInfo.getId()), String.valueOf(childJobInfo.getJobGroup()));
|
||||
|
||||
ReturnT<String> triggerChildResult = xxlJobService.triggerJob(Integer.valueOf(jobKeyArr[1]));
|
||||
// add msg
|
||||
childTriggerMsg += MessageFormat.format("<br> {0}/{1} 触发子任务成功, 子任务Key: {2}, status: {3}, 子任务描述: {4}",
|
||||
(i+1), childJobKeys.length, childJobKeys[i], ret, childJobInfo.getJobDesc());
|
||||
} catch (SchedulerException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
} else {
|
||||
childTriggerMsg += MessageFormat.format("<br> {0}/{1} 触发子任务失败, 子任务xxlJobInfo不存在, 子任务Key: {2}",
|
||||
(i+1), childJobKeys.length, childJobKeys[i]);
|
||||
}
|
||||
childTriggerMsg += MessageFormat.format("<br> {0}/{1} 触发子任务{2}, 子任务Key: {3}, 子任务触发备注: {4}",
|
||||
(i+1), childJobKeys.length, (triggerChildResult.getCode()==ReturnT.SUCCESS_CODE?"成功":"失败"), childJobKeys[i], triggerChildResult.getMsg());
|
||||
} else {
|
||||
childTriggerMsg += MessageFormat.format("<br> {0}/{1} 触发子任务失败, 子任务Key格式错误, 子任务Key: {2}",
|
||||
(i+1), childJobKeys.length, childJobKeys[i]);
|
||||
|
|
|
@ -264,6 +264,10 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|||
@Override
|
||||
public ReturnT<String> triggerJob(int id) {
|
||||
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
|
||||
if (xxlJobInfo == null) {
|
||||
return new ReturnT<String>(ReturnT.FAIL_CODE, "任务ID非法");
|
||||
}
|
||||
|
||||
String group = String.valueOf(xxlJobInfo.getJobGroup());
|
||||
String name = String.valueOf(xxlJobInfo.getId());
|
||||
|
||||
|
@ -272,7 +276,7 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|||
return ReturnT.SUCCESS;
|
||||
} catch (SchedulerException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return ReturnT.FAIL;
|
||||
return new ReturnT<String>(ReturnT.FAIL_CODE, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,8 +60,8 @@
|
|||
<#macro commonHeader>
|
||||
<header class="main-header">
|
||||
<a href="${request.contextPath}/" class="logo">
|
||||
<span class="logo-mini"><b>X</b>XL</span>
|
||||
<span class="logo-lg"><b>任务调度</b>中心</span>
|
||||
<span class="logo-mini"><b>XXL</b></span>
|
||||
<span class="logo-lg"><b>任务调度中心</b></span>
|
||||
</a>
|
||||
<nav class="navbar navbar-static-top" role="navigation">
|
||||
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"><span class="sr-only">切换导航</span></a>
|
||||
|
|
Loading…
Reference in New Issue