- 21、调度过期策略:调度中心错误调度时间的补偿处理策略,包括:忽略、立即补偿触发一次等;

- 22、触发策略强化:除了常规Cron、API、父子任务触发方式外,新增提供 "固定间隔触发、固定延时触发" 两种新触发方式;
This commit is contained in:
xueli.xue 2020-10-30 20:36:53 +08:00
parent 11a4c4ae91
commit eb9a3f0e69
16 changed files with 592 additions and 279 deletions

View File

@ -56,35 +56,36 @@ XXL-JOB是一个分布式任务调度平台其核心设计目标是开发迅
- 4、执行器HA分布式任务分布式执行任务"执行器"支持集群部署可保证任务执行HA
- 5、注册中心: 执行器会周期性自动注册任务, 调度中心将会自动发现注册的任务并触发执行。同时,也支持手动录入执行器地址;
- 6、弹性扩容缩容一旦有新执行器机器上线或者下线下次调度时将会重新分配任务
- 7、路由策略执行器集群部署时提供丰富的路由策略包括第一个、最后一个、轮询、随机、一致性HASH、最不经常使用、最近最久未使用、故障转移、忙碌转移等
- 8、故障转移:任务路由策略选择"故障转移"情况下如果执行器集群中某一台机器故障将会自动Failover切换到一台正常的执行器发送调度请求。
- 7、触发策略提供丰富的任务触发策略包括Cron触发、固定间隔触发、固定延时触发、API事件触发、人工触发、父子任务触发
- 8、调度过期策略:调度中心错误调度时间的补偿处理策略,包括:忽略、立即补偿触发一次等;
- 9、阻塞处理策略调度过于密集执行器来不及处理时的处理策略策略包括单机串行默认、丢弃后续调度、覆盖之前调度
- 10、任务超时控制支持自定义任务超时时间任务运行超时将会主动中断任务
- 11、任务失败重试支持自定义任务失败重试次数当任务失败时将会按照预设的失败重试次数主动进行重试其中分片任务支持分片粒度的失败重试
- 12、任务失败告警默认提供邮件方式失败告警同时预留扩展接口可方便的扩展短信、钉钉等告警方式
- 13、分片广播任务执行器集群部署时任务路由策略选择"分片广播"情况下,一次任务调度将会广播触发集群中所有执行器执行一次任务,可根据分片参数开发分片任务;
- 14、动态分片分片广播任务以执行器为维度进行分片支持动态扩容执行器集群从而动态增加分片数量协同进行业务处理在进行大数据量业务操作时可显著提升任务处理能力和速度。
- 15、事件触发除了"Cron方式"和"任务依赖方式"触发任务执行之外支持基于事件的触发任务方式。调度中心提供触发任务单次执行的API服务可根据业务事件灵活触发。
- 16、任务进度监控支持实时监控任务进度
- 17、Rolling实时日志支持在线查看调度结果并且支持以Rolling方式实时查看执行器输出的完整的执行日志
- 18、GLUE提供Web IDE支持在线开发任务逻辑代码动态发布实时编译生效省略部署上线的过程。支持30个版本的历史版本回溯。
- 19、脚本任务支持以GLUE模式开发和运行脚本任务包括Shell、Python、NodeJS、PHP、PowerShell等类型脚本;
- 20、命令行任务原生提供通用命令行任务HandlerBean任务"CommandJobHandler");业务方只需要提供命令行即可;
- 21、任务依赖支持配置子任务依赖当父任务执行结束且执行成功后将会主动触发一次子任务的执行, 多个子任务用逗号分隔;
- 22、一致性“调度中心”通过DB锁保证集群分布式调度的一致性, 一次任务调度只会触发一次执行;
- 23、自定义任务参数支持在线配置调度任务入参即时生效
- 24、调度线程池调度系统多线程触发调度运行确保调度精确执行不被堵塞
- 25、数据加密调度中心和执行器之间的通讯进行数据加密提升调度信息安全性
- 26、邮件报警任务失败时支持邮件报警支持配置多邮件地址群发报警邮件
- 27、推送maven中央仓库: 将会把最新稳定版推送到maven中央仓库, 方便用户接入和使用;
- 28、运行报表支持实时查看运行数据如任务数量、调度次数、执行器数量等以及调度报表如调度日期分布图调度成功分布图等
- 29、全异步任务调度流程全异步化设计实现如异步调度、异步运行、异步回调等有效对密集调度进行流量削峰理论上支持任意时长任务的运行
- 30、跨语言调度中心与执行器提供语言无关的 RESTful API 服务,第三方任意语言可据此对接调度中心或者实现执行器。除此之外,还提供了 “多任务模式”和“httpJobHandler”等其他跨语言方案
- 31、国际化调度中心支持国际化设置提供中文、英文两种可选语言默认为中文
- 32、容器化提供官方docker镜像并实时更新推送dockerhub进一步实现产品开箱即用
- 33、线程池隔离调度线程池进行隔离拆分慢任务自动降级进入"Slow"线程池,避免耗尽调度线程,提高系统稳定性;
- 34、用户管理支持在线管理系统用户存在管理员、普通用户两种角色
- 35、权限控制执行器维度进行权限控制管理员拥有全量权限普通用户需要分配执行器权限后才允许相关操作
- 13、路由策略执行器集群部署时提供丰富的路由策略包括第一个、最后一个、轮询、随机、一致性HASH、最不经常使用、最近最久未使用、故障转移、忙碌转移等
- 14、分片广播任务执行器集群部署时任务路由策略选择"分片广播"情况下,一次任务调度将会广播触发集群中所有执行器执行一次任务,可根据分片参数开发分片任务;
- 15、动态分片分片广播任务以执行器为维度进行分片支持动态扩容执行器集群从而动态增加分片数量协同进行业务处理在进行大数据量业务操作时可显著提升任务处理能力和速度。
- 16、故障转移任务路由策略选择"故障转移"情况下如果执行器集群中某一台机器故障将会自动Failover切换到一台正常的执行器发送调度请求。
- 17、任务进度监控支持实时监控任务进度
- 18、Rolling实时日志支持在线查看调度结果并且支持以Rolling方式实时查看执行器输出的完整的执行日志
- 19、GLUE提供Web IDE支持在线开发任务逻辑代码动态发布实时编译生效省略部署上线的过程。支持30个版本的历史版本回溯。
- 20、脚本任务支持以GLUE模式开发和运行脚本任务包括Shell、Python、NodeJS、PHP、PowerShell等类型脚本;
- 21、命令行任务原生提供通用命令行任务HandlerBean任务"CommandJobHandler");业务方只需要提供命令行即可;
- 22、任务依赖支持配置子任务依赖当父任务执行结束且执行成功后将会主动触发一次子任务的执行, 多个子任务用逗号分隔;
- 23、一致性“调度中心”通过DB锁保证集群分布式调度的一致性, 一次任务调度只会触发一次执行;
- 24、自定义任务参数支持在线配置调度任务入参即时生效
- 25、调度线程池调度系统多线程触发调度运行确保调度精确执行不被堵塞
- 26、数据加密调度中心和执行器之间的通讯进行数据加密提升调度信息安全性
- 27、邮件报警任务失败时支持邮件报警支持配置多邮件地址群发报警邮件
- 28、推送maven中央仓库: 将会把最新稳定版推送到maven中央仓库, 方便用户接入和使用;
- 29、运行报表支持实时查看运行数据如任务数量、调度次数、执行器数量等以及调度报表如调度日期分布图调度成功分布图等
- 30、全异步任务调度流程全异步化设计实现如异步调度、异步运行、异步回调等有效对密集调度进行流量削峰理论上支持任意时长任务的运行
- 31、跨语言调度中心与执行器提供语言无关的 RESTful API 服务,第三方任意语言可据此对接调度中心或者实现执行器。除此之外,还提供了 “多任务模式”和“httpJobHandler”等其他跨语言方案
- 32、国际化调度中心支持国际化设置提供中文、英文两种可选语言默认为中文
- 33、容器化提供官方docker镜像并实时更新推送dockerhub进一步实现产品开箱即用
- 34、线程池隔离调度线程池进行隔离拆分慢任务自动降级进入"Slow"线程池,避免耗尽调度线程,提高系统稳定性;
- 35、用户管理支持在线管理系统用户存在管理员、普通用户两种角色
- 36、权限控制执行器维度进行权限控制管理员拥有全量权限普通用户需要分配执行器权限后才允许相关操作
## Development

View File

@ -27,35 +27,36 @@ XXL-JOB是一个分布式任务调度平台其核心设计目标是开发迅
- 4、执行器HA分布式任务分布式执行任务"执行器"支持集群部署可保证任务执行HA
- 5、注册中心: 执行器会周期性自动注册任务, 调度中心将会自动发现注册的任务并触发执行。同时,也支持手动录入执行器地址;
- 6、弹性扩容缩容一旦有新执行器机器上线或者下线下次调度时将会重新分配任务
- 7、路由策略执行器集群部署时提供丰富的路由策略包括第一个、最后一个、轮询、随机、一致性HASH、最不经常使用、最近最久未使用、故障转移、忙碌转移等
- 8、故障转移:任务路由策略选择"故障转移"情况下如果执行器集群中某一台机器故障将会自动Failover切换到一台正常的执行器发送调度请求。
- 7、触发策略提供丰富的任务触发策略包括Cron触发、固定间隔触发、固定延时触发、API事件触发、人工触发、父子任务触发
- 8、调度过期策略:调度中心错误调度时间的补偿处理策略,包括:忽略、立即补偿触发一次等;
- 9、阻塞处理策略调度过于密集执行器来不及处理时的处理策略策略包括单机串行默认、丢弃后续调度、覆盖之前调度
- 10、任务超时控制支持自定义任务超时时间任务运行超时将会主动中断任务
- 11、任务失败重试支持自定义任务失败重试次数当任务失败时将会按照预设的失败重试次数主动进行重试其中分片任务支持分片粒度的失败重试
- 12、任务失败告警默认提供邮件方式失败告警同时预留扩展接口可方便的扩展短信、钉钉等告警方式
- 13、分片广播任务执行器集群部署时任务路由策略选择"分片广播"情况下,一次任务调度将会广播触发集群中所有执行器执行一次任务,可根据分片参数开发分片任务;
- 14、动态分片分片广播任务以执行器为维度进行分片支持动态扩容执行器集群从而动态增加分片数量协同进行业务处理在进行大数据量业务操作时可显著提升任务处理能力和速度。
- 15、事件触发除了"Cron方式"和"任务依赖方式"触发任务执行之外支持基于事件的触发任务方式。调度中心提供触发任务单次执行的API服务可根据业务事件灵活触发。
- 16、任务进度监控支持实时监控任务进度
- 17、Rolling实时日志支持在线查看调度结果并且支持以Rolling方式实时查看执行器输出的完整的执行日志
- 18、GLUE提供Web IDE支持在线开发任务逻辑代码动态发布实时编译生效省略部署上线的过程。支持30个版本的历史版本回溯。
- 19、脚本任务支持以GLUE模式开发和运行脚本任务包括Shell、Python、NodeJS、PHP、PowerShell等类型脚本;
- 20、命令行任务原生提供通用命令行任务HandlerBean任务"CommandJobHandler");业务方只需要提供命令行即可;
- 21、任务依赖支持配置子任务依赖当父任务执行结束且执行成功后将会主动触发一次子任务的执行, 多个子任务用逗号分隔;
- 22、一致性“调度中心”通过DB锁保证集群分布式调度的一致性, 一次任务调度只会触发一次执行;
- 23、自定义任务参数支持在线配置调度任务入参即时生效
- 24、调度线程池调度系统多线程触发调度运行确保调度精确执行不被堵塞
- 25、数据加密调度中心和执行器之间的通讯进行数据加密提升调度信息安全性
- 26、邮件报警任务失败时支持邮件报警支持配置多邮件地址群发报警邮件
- 27、推送maven中央仓库: 将会把最新稳定版推送到maven中央仓库, 方便用户接入和使用;
- 28、运行报表支持实时查看运行数据如任务数量、调度次数、执行器数量等以及调度报表如调度日期分布图调度成功分布图等
- 29、全异步任务调度流程全异步化设计实现如异步调度、异步运行、异步回调等有效对密集调度进行流量削峰理论上支持任意时长任务的运行
- 30、跨语言调度中心与执行器提供语言无关的 RESTful API 服务,第三方任意语言可据此对接调度中心或者实现执行器。除此之外,还提供了 “多任务模式”和“httpJobHandler”等其他跨语言方案
- 31、国际化调度中心支持国际化设置提供中文、英文两种可选语言默认为中文
- 32、容器化提供官方docker镜像并实时更新推送dockerhub进一步实现产品开箱即用
- 33、线程池隔离调度线程池进行隔离拆分慢任务自动降级进入"Slow"线程池,避免耗尽调度线程,提高系统稳定性;
- 34、用户管理支持在线管理系统用户存在管理员、普通用户两种角色
- 35、权限控制执行器维度进行权限控制管理员拥有全量权限普通用户需要分配执行器权限后才允许相关操作
- 13、路由策略执行器集群部署时提供丰富的路由策略包括第一个、最后一个、轮询、随机、一致性HASH、最不经常使用、最近最久未使用、故障转移、忙碌转移等
- 14、分片广播任务执行器集群部署时任务路由策略选择"分片广播"情况下,一次任务调度将会广播触发集群中所有执行器执行一次任务,可根据分片参数开发分片任务;
- 15、动态分片分片广播任务以执行器为维度进行分片支持动态扩容执行器集群从而动态增加分片数量协同进行业务处理在进行大数据量业务操作时可显著提升任务处理能力和速度。
- 16、故障转移任务路由策略选择"故障转移"情况下如果执行器集群中某一台机器故障将会自动Failover切换到一台正常的执行器发送调度请求。
- 17、任务进度监控支持实时监控任务进度
- 18、Rolling实时日志支持在线查看调度结果并且支持以Rolling方式实时查看执行器输出的完整的执行日志
- 19、GLUE提供Web IDE支持在线开发任务逻辑代码动态发布实时编译生效省略部署上线的过程。支持30个版本的历史版本回溯。
- 20、脚本任务支持以GLUE模式开发和运行脚本任务包括Shell、Python、NodeJS、PHP、PowerShell等类型脚本;
- 21、命令行任务原生提供通用命令行任务HandlerBean任务"CommandJobHandler");业务方只需要提供命令行即可;
- 22、任务依赖支持配置子任务依赖当父任务执行结束且执行成功后将会主动触发一次子任务的执行, 多个子任务用逗号分隔;
- 23、一致性“调度中心”通过DB锁保证集群分布式调度的一致性, 一次任务调度只会触发一次执行;
- 24、自定义任务参数支持在线配置调度任务入参即时生效
- 25、调度线程池调度系统多线程触发调度运行确保调度精确执行不被堵塞
- 26、数据加密调度中心和执行器之间的通讯进行数据加密提升调度信息安全性
- 27、邮件报警任务失败时支持邮件报警支持配置多邮件地址群发报警邮件
- 28、推送maven中央仓库: 将会把最新稳定版推送到maven中央仓库, 方便用户接入和使用;
- 29、运行报表支持实时查看运行数据如任务数量、调度次数、执行器数量等以及调度报表如调度日期分布图调度成功分布图等
- 30、全异步任务调度流程全异步化设计实现如异步调度、异步运行、异步回调等有效对密集调度进行流量削峰理论上支持任意时长任务的运行
- 31、跨语言调度中心与执行器提供语言无关的 RESTful API 服务,第三方任意语言可据此对接调度中心或者实现执行器。除此之外,还提供了 “多任务模式”和“httpJobHandler”等其他跨语言方案
- 32、国际化调度中心支持国际化设置提供中文、英文两种可选语言默认为中文
- 33、容器化提供官方docker镜像并实时更新推送dockerhub进一步实现产品开箱即用
- 34、线程池隔离调度线程池进行隔离拆分慢任务自动降级进入"Slow"线程池,避免耗尽调度线程,提高系统稳定性;
- 35、用户管理支持在线管理系统用户存在管理员、普通用户两种角色
- 36、权限控制执行器维度进行权限控制管理员拥有全量权限普通用户需要分配执行器权限后才允许相关操作
### 1.4 发展
于2015年中我在github上创建XXL-JOB项目仓库并提交第一个commit随之进行系统结构设计UI选型交互设计……
@ -765,8 +766,35 @@ public XxlJobSpringExecutor xxlJobExecutor() {
### 配置属性详细说明:
基础配置:
- 执行器:任务的绑定的执行器,任务触发调度时将会自动发现注册成功的执行器, 实现任务自动发现功能; 另一方面也可以方便的进行任务分组。每个任务必须绑定一个执行器, 可在 "执行器管理" 进行设置;
- 任务描述:任务的描述信息,便于任务管理;
- 负责人:任务的负责人;
- 报警邮件:任务调度失败时邮件通知的邮箱地址,支持配置多邮箱地址,配置多个邮箱地址时用逗号分隔;
触发配置:
- 调度类型:
无:该类型不会主动触发调度;
CRON该类型将会通过CRON触发任务调度
固定速度:该类型将会以固定速度,触发任务调度;按照固定的间隔时间,周期性触发;
固定延迟:该类型将会以固定延迟,触发任务调度;按照固定的延迟时间,从上次调度结束后开始计算延迟时间,到达延迟时间后触发下次调度;
- CRON触发任务执行的Cron表达式
- 固定速度:固件速度的时间间隔,单位为秒;
- 固定延迟:固件延迟的时间间隔,单位为秒;
任务配置:
- 运行模式:
BEAN模式任务以JobHandler方式维护在执行器端需要结合 "JobHandler" 属性匹配执行器中任务;
GLUE模式(Java)任务以源码方式维护在调度中心该模式的任务实际上是一段继承自IJobHandler的Java类代码并 "groovy" 源码方式维护,它在执行器项目中运行,可使用@Resource/@Autowire注入执行器里中的其他服务
GLUE模式(Shell):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "shell" 脚本;
GLUE模式(Python):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "python" 脚本;
GLUE模式(PHP):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "php" 脚本;
GLUE模式(NodeJS):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "nodejs" 脚本;
GLUE模式(PowerShell):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "PowerShell" 脚本;
- JobHandler运行模式为 "BEAN模式" 时生效对应执行器中新开发的JobHandler类“@JobHandler”注解自定义的value值
- 执行参数:任务执行所需的参数;
高级配置:
- 路由策略:当执行器集群部署时,提供丰富的路由策略,包括;
FIRST第一个固定选择第一个机器
LAST最后一个固定选择最后一个机器
@ -778,27 +806,19 @@ public XxlJobSpringExecutor xxlJobExecutor() {
FAILOVER故障转移按照顺序依次进行心跳检测第一个心跳检测成功的机器选定为目标执行器并发起调度
BUSYOVER忙碌转移按照顺序依次进行空闲检测第一个空闲检测成功的机器选定为目标执行器并发起调度
SHARDING_BROADCAST(分片广播):广播触发对应集群中所有机器执行一次任务,同时系统自动传递分片参数;可根据分片参数开发分片任务;
- Cron触发任务执行的Cron表达式
- 运行模式:
BEAN模式任务以JobHandler方式维护在执行器端需要结合 "JobHandler" 属性匹配执行器中任务;
GLUE模式(Java)任务以源码方式维护在调度中心该模式的任务实际上是一段继承自IJobHandler的Java类代码并 "groovy" 源码方式维护,它在执行器项目中运行,可使用@Resource/@Autowire注入执行器里中的其他服务
GLUE模式(Shell):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "shell" 脚本;
GLUE模式(Python):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "python" 脚本;
GLUE模式(PHP):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "php" 脚本;
GLUE模式(NodeJS):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "nodejs" 脚本;
GLUE模式(PowerShell):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "PowerShell" 脚本;
- JobHandler运行模式为 "BEAN模式" 时生效对应执行器中新开发的JobHandler类“@JobHandler”注解自定义的value值
- 子任务每个任务都拥有一个唯一的任务ID(任务ID可以从任务列表获取)当本任务执行结束并且执行成功时将会触发子任务ID所对应的任务的一次主动调度。
- 调度过期策略:
- 忽略:调度过期后,忽略过期的任务,从当前时间开始重新计算下次触发时间;
- 立即执行一次:调度过期后,立即执行一次,并从当前时间开始重新计算下次触发时间;
- 阻塞处理策略:调度过于密集执行器来不及处理时的处理策略;
单机串行默认调度请求进入单机执行器后调度请求进入FIFO队列并以串行方式运行
丢弃后续调度:调度请求进入单机执行器后,发现执行器存在运行的调度任务,本次请求将会被丢弃并标记为失败;
覆盖之前调度:调度请求进入单机执行器后,发现执行器存在运行的调度任务,将会终止运行中的调度任务并清空队列,然后运行本地调度任务;
- 子任务每个任务都拥有一个唯一的任务ID(任务ID可以从任务列表获取)当本任务执行结束并且执行成功时将会触发子任务ID所对应的任务的一次主动调度。
- 任务超时时间:支持自定义任务超时时间,任务运行超时将会主动中断任务;
- 失败重试次数;支持自定义任务失败重试次数,当任务失败时将会按照预设的失败重试次数主动进行重试;
- 报警邮件:任务调度失败时邮件通知的邮箱地址,支持配置多邮箱地址,配置多个邮箱地址时用逗号分隔;
- 负责人:任务的负责人;
- 执行参数:任务执行所需的参数;
### 3.1 BEAN模式类形式
@ -2064,8 +2084,8 @@ data: post-data
- 18、执行器Commandhandler示例任务优化修复极端情况下脚本进程挂起问题
- 19、调度中心页面交互优化用户管理模块密码列取消多处表达autocomplete取消执行器管理模块XSS拦截校验等
- 20、执行器注册组件优化注册逻辑调整为异步方式提高注册性能
- 21、[ING]任务触发参数优化:支持选择 "无API/人工)""Cron触发"、"固定间隔"、"固定延时"等;
- 22、[ING]任务 misfire 策略:忽略、补偿一次等
- 21、调度过期策略:调度中心错误调度时间的补偿处理策略,包括:忽略、立即补偿触发一次等;
- 22、触发策略强化除了常规Cron、API、父子任务触发方式外新增提供 "固定间隔触发、固定延时触发" 两种新触发方式
### 7.32 版本 v2.3.0 Release Notes[规划中]

View File

@ -10,7 +10,6 @@ SET NAMES utf8mb4;
CREATE TABLE `xxl_job_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`job_group` int(11) NOT NULL COMMENT '执行器主键ID',
`job_cron` varchar(128) NOT NULL COMMENT '任务执行CRON',
`job_desc` varchar(255) NOT NULL,
`add_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
@ -115,7 +114,7 @@ CREATE TABLE `xxl_job_lock` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `xxl_job_group`(`id`, `app_name`, `title`, `address_type`, `address_list`, `update_time`) VALUES (1, 'xxl-job-executor-sample', '示例执行器', 0, NULL, '2018-11-03 22:21:31' );
INSERT INTO `xxl_job_info`(`id`, `job_group`, `job_cron`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `schedule_type`, `schedule_conf`, `misfire_strategy`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`) VALUES (1, 1, '0 0 0 * * ? *', '测试任务1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'CRON', '0 0 0 * * ? *', 'DO_NOTHING', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2018-11-03 22:21:31', '');
INSERT INTO `xxl_job_info`(`id`, `job_group`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `schedule_type`, `schedule_conf`, `misfire_strategy`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`) VALUES (1, 1, '测试任务1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'CRON', '0 0 0 * * ? *', 'DO_NOTHING', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2018-11-03 22:21:31', '');
INSERT INTO `xxl_job_user`(`id`, `username`, `password`, `role`, `permission`) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL);
INSERT INTO `xxl_job_lock` ( `lock_name`) VALUES ( 'schedule_lock');

View File

@ -12,7 +12,6 @@ public class XxlJobInfo {
private int id; // 主键ID
private int jobGroup; // 执行器主键ID
private String jobCron; // 任务执行CRON表达式
private String jobDesc;
private Date addTime;
@ -21,6 +20,10 @@ public class XxlJobInfo {
private String author; // 负责人
private String alarmEmail; // 报警邮件
private String scheduleType; // 调度类型
private String scheduleConf; // 调度配置值含义取决于调度类型
private String misfireStrategy; // 调度过期策略
private String executorRouteStrategy; // 执行器路由策略
private String executorHandler; // 执行器任务Handler名称
private String executorParam; // 执行器任务参数
@ -56,14 +59,6 @@ public class XxlJobInfo {
this.jobGroup = jobGroup;
}
public String getJobCron() {
return jobCron;
}
public void setJobCron(String jobCron) {
this.jobCron = jobCron;
}
public String getJobDesc() {
return jobDesc;
}
@ -104,6 +99,30 @@ public class XxlJobInfo {
this.alarmEmail = alarmEmail;
}
public String getScheduleType() {
return scheduleType;
}
public void setScheduleType(String scheduleType) {
this.scheduleType = scheduleType;
}
public String getScheduleConf() {
return scheduleConf;
}
public void setScheduleConf(String scheduleConf) {
this.scheduleConf = scheduleConf;
}
public String getMisfireStrategy() {
return misfireStrategy;
}
public void setMisfireStrategy(String misfireStrategy) {
this.misfireStrategy = misfireStrategy;
}
public String getExecutorRouteStrategy() {
return executorRouteStrategy;
}

View File

@ -27,13 +27,13 @@ public enum MisfireStrategyEnum {
return title;
}
public static MisfireStrategyEnum match(String name){
public static MisfireStrategyEnum match(String name, MisfireStrategyEnum defaultItem){
for (MisfireStrategyEnum item: MisfireStrategyEnum.values()) {
if (item.name().equals(name)) {
return item;
}
}
return DO_NOTHING;
return defaultItem;
}
}

View File

@ -34,13 +34,13 @@ public enum ScheduleTypeEnum {
return title;
}
public static ScheduleTypeEnum match(String name){
public static ScheduleTypeEnum match(String name, ScheduleTypeEnum defaultItem){
for (ScheduleTypeEnum item: ScheduleTypeEnum.values()) {
if (item.equals(name)) {
if (item.name().equals(name)) {
return item;
}
}
return NONE;
return defaultItem;
}
}

View File

@ -3,6 +3,8 @@ package com.xxl.job.admin.core.thread;
import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
import com.xxl.job.admin.core.cron.CronExpression;
import com.xxl.job.admin.core.model.XxlJobInfo;
import com.xxl.job.admin.core.scheduler.MisfireStrategyEnum;
import com.xxl.job.admin.core.scheduler.ScheduleTypeEnum;
import com.xxl.job.admin.core.trigger.TriggerTypeEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -86,7 +88,15 @@ public class JobScheduleHelper {
// 2.1trigger-expire > 5spass && make next-trigger-time
logger.warn(">>>>>>>>>>> xxl-job, schedule misfire, jobId = " + jobInfo.getId());
// fresh next
// 1misfire match
MisfireStrategyEnum misfireStrategyEnum = MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), MisfireStrategyEnum.DO_NOTHING);
if (MisfireStrategyEnum.FIRE_ONCE_NOW == misfireStrategyEnum) {
// FIRE_ONCE_NOW trigger
JobTriggerPoolHelper.trigger(jobInfo.getId(), TriggerTypeEnum.MISFIRE, -1, null, null, null);
logger.debug(">>>>>>>>>>> xxl-job, schedule push trigger : jobId = " + jobInfo.getId() );
}
// 2fresh next
refreshNextValidTime(jobInfo, new Date());
} else if (nowTime > jobInfo.getTriggerNextTime()) {
@ -270,7 +280,7 @@ public class JobScheduleHelper {
}
private void refreshNextValidTime(XxlJobInfo jobInfo, Date fromTime) throws ParseException {
Date nextValidTime = new CronExpression(jobInfo.getJobCron()).getNextValidTimeAfter(fromTime);
Date nextValidTime = generateNextValidTime(jobInfo, fromTime);
if (nextValidTime != null) {
jobInfo.setTriggerLastTime(jobInfo.getTriggerNextTime());
jobInfo.setTriggerNextTime(nextValidTime.getTime());
@ -278,6 +288,8 @@ public class JobScheduleHelper {
jobInfo.setTriggerStatus(0);
jobInfo.setTriggerLastTime(0);
jobInfo.setTriggerNextTime(0);
logger.warn(">>>>>>>>>>> xxl-job, refreshNextValidTime fail for job: jobId={}, scheduleType={}, scheduleConf={}",
jobInfo.getId(), jobInfo.getScheduleType(), jobInfo.getScheduleConf());
}
}
@ -351,4 +363,17 @@ public class JobScheduleHelper {
logger.info(">>>>>>>>>>> xxl-job, JobScheduleHelper stop");
}
// ---------------------- tools ----------------------
public static Date generateNextValidTime(XxlJobInfo jobInfo, Date fromTime) throws ParseException {
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
if (ScheduleTypeEnum.CRON == scheduleTypeEnum) {
Date nextValidTime = new CronExpression(jobInfo.getScheduleConf()).getNextValidTimeAfter(fromTime);
return nextValidTime;
} else if (ScheduleTypeEnum.FIX_RATE == scheduleTypeEnum || ScheduleTypeEnum.FIX_DELAY == scheduleTypeEnum) {
return new Date(fromTime.getTime() + Integer.valueOf(jobInfo.getScheduleConf())*1000 );
}
return null;
}
}

View File

@ -13,7 +13,8 @@ public enum TriggerTypeEnum {
CRON(I18nUtil.getString("jobconf_trigger_type_cron")),
RETRY(I18nUtil.getString("jobconf_trigger_type_retry")),
PARENT(I18nUtil.getString("jobconf_trigger_type_parent")),
API(I18nUtil.getString("jobconf_trigger_type_api"));
API(I18nUtil.getString("jobconf_trigger_type_api")),
MISFIRE(I18nUtil.getString("jobconf_trigger_type_misfire"));
private TriggerTypeEnum(String title){
this.title = title;

View File

@ -1,10 +1,12 @@
package com.xxl.job.admin.service.impl;
import com.xxl.job.admin.core.cron.CronExpression;
import com.xxl.job.admin.core.model.XxlJobGroup;
import com.xxl.job.admin.core.model.XxlJobInfo;
import com.xxl.job.admin.core.cron.CronExpression;
import com.xxl.job.admin.core.model.XxlJobLogReport;
import com.xxl.job.admin.core.route.ExecutorRouteStrategyEnum;
import com.xxl.job.admin.core.scheduler.MisfireStrategyEnum;
import com.xxl.job.admin.core.scheduler.ScheduleTypeEnum;
import com.xxl.job.admin.core.thread.JobScheduleHelper;
import com.xxl.job.admin.core.util.I18nUtil;
import com.xxl.job.admin.dao.*;
@ -58,39 +60,66 @@ public class XxlJobServiceImpl implements XxlJobService {
@Override
public ReturnT<String> add(XxlJobInfo jobInfo) {
// valid
// valid base
XxlJobGroup group = xxlJobGroupDao.load(jobInfo.getJobGroup());
if (group == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_choose")+I18nUtil.getString("jobinfo_field_jobgroup")) );
}
if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid") );
}
if (jobInfo.getJobDesc()==null || jobInfo.getJobDesc().trim().length()==0) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_jobdesc")) );
}
if (jobInfo.getAuthor()==null || jobInfo.getAuthor().trim().length()==0) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_author")) );
}
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
// valid trigger
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
if (scheduleTypeEnum == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
}
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
if (jobInfo.getScheduleConf()==null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid") );
}
} else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE || scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY) {
if (jobInfo.getScheduleConf() == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
}
try {
int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
if (fixSecond < 1) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
}
} catch (Exception e) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
}
}
// valid job
if (GlueTypeEnum.match(jobInfo.getGlueType()) == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_gluetype")+I18nUtil.getString("system_unvalid")) );
}
if (GlueTypeEnum.BEAN==GlueTypeEnum.match(jobInfo.getGlueType()) && (jobInfo.getExecutorHandler()==null || jobInfo.getExecutorHandler().trim().length()==0) ) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+"JobHandler") );
}
// fix "\r" in shell
// fix "\r" in shell
if (GlueTypeEnum.GLUE_SHELL==GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource()!=null) {
jobInfo.setGlueSource(jobInfo.getGlueSource().replaceAll("\r", ""));
}
// ChildJobId valid
// valid advanced
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
}
if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_unvalid")) );
}
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
}
// ChildJobId valid
if (jobInfo.getChildJobId()!=null && jobInfo.getChildJobId().trim().length()>0) {
String[] childJobIds = jobInfo.getChildJobId().split(",");
for (String childJobIdItem: childJobIds) {
@ -140,24 +169,49 @@ public class XxlJobServiceImpl implements XxlJobService {
@Override
public ReturnT<String> update(XxlJobInfo jobInfo) {
// valid
if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid") );
}
// valid base
if (jobInfo.getJobDesc()==null || jobInfo.getJobDesc().trim().length()==0) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_jobdesc")) );
}
if (jobInfo.getAuthor()==null || jobInfo.getAuthor().trim().length()==0) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_author")) );
}
// valid trigger
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
if (scheduleTypeEnum == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
}
if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
if (jobInfo.getScheduleConf()==null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid") );
}
} else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE || scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY) {
if (jobInfo.getScheduleConf() == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
}
try {
int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
if (fixSecond < 1) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
}
} catch (Exception e) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
}
}
// valid advanced
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
}
if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_unvalid")) );
}
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
}
// ChildJobId valid
// ChildJobId valid
if (jobInfo.getChildJobId()!=null && jobInfo.getChildJobId().trim().length()>0) {
String[] childJobIds = jobInfo.getChildJobId().split(",");
for (String childJobIdItem: childJobIds) {
@ -197,24 +251,27 @@ public class XxlJobServiceImpl implements XxlJobService {
// next trigger time (5s后生效避开预读周期)
long nextTriggerTime = exists_jobInfo.getTriggerNextTime();
if (exists_jobInfo.getTriggerStatus() == 1 && !jobInfo.getJobCron().equals(exists_jobInfo.getJobCron()) ) {
boolean scheduleDataNotChanged = jobInfo.getScheduleType().equals(exists_jobInfo.getScheduleType()) && jobInfo.getScheduleConf().equals(exists_jobInfo.getScheduleConf());
if (exists_jobInfo.getTriggerStatus() == 1 && !scheduleDataNotChanged) {
try {
Date nextValidTime = new CronExpression(jobInfo.getJobCron()).getNextValidTimeAfter(new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
Date nextValidTime = JobScheduleHelper.generateNextValidTime(jobInfo, new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
if (nextValidTime == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_never_fire"));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
}
nextTriggerTime = nextValidTime.getTime();
} catch (ParseException e) {
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid")+" | "+ e.getMessage());
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
}
}
exists_jobInfo.setJobGroup(jobInfo.getJobGroup());
exists_jobInfo.setJobCron(jobInfo.getJobCron());
exists_jobInfo.setJobDesc(jobInfo.getJobDesc());
exists_jobInfo.setAuthor(jobInfo.getAuthor());
exists_jobInfo.setAlarmEmail(jobInfo.getAlarmEmail());
exists_jobInfo.setScheduleType(jobInfo.getScheduleType());
exists_jobInfo.setScheduleConf(jobInfo.getScheduleConf());
exists_jobInfo.setMisfireStrategy(jobInfo.getMisfireStrategy());
exists_jobInfo.setExecutorRouteStrategy(jobInfo.getExecutorRouteStrategy());
exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler());
exists_jobInfo.setExecutorParam(jobInfo.getExecutorParam());
@ -248,17 +305,23 @@ public class XxlJobServiceImpl implements XxlJobService {
public ReturnT<String> start(int id) {
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
// valid
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(xxlJobInfo.getScheduleType(), ScheduleTypeEnum.NONE);
if (ScheduleTypeEnum.NONE == scheduleTypeEnum) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type_none_limit_start")) );
}
// next trigger time (5s后生效避开预读周期)
long nextTriggerTime = 0;
try {
Date nextValidTime = new CronExpression(xxlJobInfo.getJobCron()).getNextValidTimeAfter(new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
Date nextValidTime = JobScheduleHelper.generateNextValidTime(xxlJobInfo, new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
if (nextValidTime == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_never_fire"));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
}
nextTriggerTime = nextValidTime.getTime();
} catch (ParseException e) {
logger.error(e.getMessage(), e);
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid")+" | "+ e.getMessage());
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
}
xxlJobInfo.setTriggerStatus(1);

View File

@ -149,9 +149,14 @@ schedule_type_none=None
schedule_type_cron=Cron
schedule_type_fix_rate=Fix rate
schedule_type_fix_delay=Fix delay
schedule_type_none_limit_start=The current schedule type disables startup
misfire_strategy=Misfire strategy
misfire_strategy_do_nothing=Do nothing
misfire_strategy_fire_once_now=Fire once now
jobinfo_conf_base=Base configuration
jobinfo_conf_trigger=Trigger configuration
jobinfo_conf_job=Job configuration
jobinfo_conf_advanced=Advanced configuration
## job log
joblog_name=Trigger Log
@ -251,6 +256,7 @@ jobconf_trigger_type_manual=Manual trigger
jobconf_trigger_type_parent=Parent job trigger
jobconf_trigger_type_api=Api trigger
jobconf_trigger_type_retry=Fail retry trigger
jobconf_trigger_type_misfire=Misfire compensation trigger
## user
user_manage=User Manage

View File

@ -149,9 +149,14 @@ schedule_type_none=无
schedule_type_cron=CRON
schedule_type_fix_rate=固定速度
schedule_type_fix_delay=固定延迟
schedule_type_none_limit_start=当前调度类型禁止启动
misfire_strategy=调度过期策略
misfire_strategy_do_nothing=忽略
misfire_strategy_fire_once_now=立即执行一次
jobinfo_conf_base=基础配置
jobinfo_conf_trigger=触发配置
jobinfo_conf_job=任务配置
jobinfo_conf_advanced=高级信息
## job log
joblog_name=调度日志
@ -251,6 +256,7 @@ jobconf_trigger_type_manual=手动触发
jobconf_trigger_type_parent=父任务触发
jobconf_trigger_type_api=API触发
jobconf_trigger_type_retry=失败重试触发
jobconf_trigger_type_misfire=调度过期补偿
## user
user_manage=用户管理

View File

@ -149,9 +149,14 @@ schedule_type_none=無
schedule_type_cron=CRON
schedule_type_fix_rate=固定速度
schedule_type_fix_delay=固定延遲
schedule_type_none_limit_start=當前調度類型禁止啟動
misfire_strategy=調度過期策略
misfire_strategy_do_nothing=忽略
misfire_strategy_fire_once_now=立即執行壹次
jobinfo_conf_base=基礎配置
jobinfo_conf_trigger=觸發配置
jobinfo_conf_job=任務配置
jobinfo_conf_advanced=高級信息
## job log
joblog_name=調度日誌
@ -251,6 +256,7 @@ jobconf_trigger_type_manual=手動觸發
jobconf_trigger_type_parent=父任務觸發
jobconf_trigger_type_api=API觸發
jobconf_trigger_type_retry=失敗重試觸發
jobconf_trigger_type_misfire=調度過期補償
## user
user_manage=用户管理

View File

@ -7,7 +7,6 @@
<result column="id" property="id" />
<result column="job_group" property="jobGroup" />
<result column="job_cron" property="jobCron" />
<result column="job_desc" property="jobDesc" />
<result column="add_time" property="addTime" />
@ -16,6 +15,10 @@
<result column="author" property="author" />
<result column="alarm_email" property="alarmEmail" />
<result column="schedule_type" property="scheduleType" />
<result column="schedule_conf" property="scheduleConf" />
<result column="misfire_strategy" property="misfireStrategy" />
<result column="executor_route_strategy" property="executorRouteStrategy" />
<result column="executor_handler" property="executorHandler" />
<result column="executor_param" property="executorParam" />
@ -38,12 +41,14 @@
<sql id="Base_Column_List">
t.id,
t.job_group,
t.job_cron,
t.job_desc,
t.add_time,
t.update_time,
t.author,
t.alarm_email,
t.schedule_type,
t.schedule_conf,
t.misfire_strategy,
t.executor_route_strategy,
t.executor_handler,
t.executor_param,
@ -109,12 +114,14 @@
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO xxl_job_info (
job_group,
job_cron,
job_desc,
add_time,
update_time,
author,
alarm_email,
schedule_type,
schedule_conf,
misfire_strategy,
executor_route_strategy,
executor_handler,
executor_param,
@ -131,12 +138,14 @@
trigger_next_time
) VALUES (
#{jobGroup},
#{jobCron},
#{jobDesc},
#{addTime},
#{updateTime},
#{author},
#{alarmEmail},
#{scheduleType},
#{scheduleConf},
#{misfireStrategy},
#{executorRouteStrategy},
#{executorHandler},
#{executorParam},
@ -168,11 +177,13 @@
UPDATE xxl_job_info
SET
job_group = #{jobGroup},
job_cron = #{jobCron},
job_desc = #{jobDesc},
update_time = #{updateTime},
author = #{author},
alarm_email = #{alarmEmail},
schedule_type = #{scheduleType},
schedule_conf = #{scheduleConf},
misfire_strategy = #{misfireStrategy},
executor_route_strategy = #{executorRouteStrategy},
executor_handler = #{executorHandler},
executor_param = #{executorParam},

View File

@ -48,6 +48,18 @@ $(function() {
"visible" : true,
"width":'25%'
},
{
"data": 'scheduleType',
"visible" : true,
"width":'13%',
"render": function ( data, type, row ) {
if (row.scheduleConf) {
return row.scheduleType + ''+ row.scheduleConf;
} else {
return row.scheduleType;
}
}
},
{
"data": 'glueType',
"width":'25%',
@ -62,11 +74,6 @@ $(function() {
}
},
{ "data": 'executorParam', "visible" : false},
{
"data": 'jobCron',
"visible" : true,
"width":'13%'
},
{
"data": 'addTime',
"visible" : false,
@ -364,8 +371,8 @@ $(function() {
$(".add").click(function(){
// init-cronGen
$("#addModal .form input[name='jobCron']").show().siblings().remove();
$("#addModal .form input[name='jobCron']").cronGen({});
$("#addModal .form input[name='schedule_conf_CRON']").show().siblings().remove();
$("#addModal .form input[name='schedule_conf_CRON']").cronGen({});
$('#addModal').modal({backdrop: false, keyboard: false}).modal('show');
});
@ -378,35 +385,29 @@ $(function() {
required : true,
maxlength: 50
},
jobCron : {
required : true
},
author : {
required : true
},
}/*,
executorTimeout : {
digits:true
},
executorFailRetryCount : {
digits:true
}
}*/
},
messages : {
jobDesc : {
required : I18n.system_please_input + I18n.jobinfo_field_jobdesc
},
jobCron : {
required : I18n.system_please_input + "Cron"
},
author : {
required : I18n.system_please_input + I18n.jobinfo_field_author
},
}/*,
executorTimeout : {
digits: I18n.system_please_input + I18n.system_digits
},
executorFailRetryCount : {
digits: I18n.system_please_input + I18n.system_digits
}
}*/
},
highlight : function(element) {
$(element).closest('.form-group').addClass('has-error');
@ -420,7 +421,7 @@ $(function() {
},
submitHandler : function(form) {
// process
// process executorTimeout+executorFailRetryCount
var executorTimeout = $("#addModal .form input[name='executorTimeout']").val();
if(!/^\d+$/.test(executorTimeout)) {
executorTimeout = 0;
@ -432,8 +433,17 @@ $(function() {
}
$("#addModal .form input[name='executorFailRetryCount']").val(executorFailRetryCount);
// process-cronGen
$("#addModal .form input[name='jobCron']").val( $("#addModal .form input[name='cronGen_display']").val() );
// process schedule_conf
var scheduleType = $("#addModal .form select[name='scheduleType']").val();
var scheduleConf;
if (scheduleType == 'CRON') {
scheduleConf = $("#addModal .form input[name='cronGen_display']").val();
} else if (scheduleType == 'FIX_RATE') {
scheduleConf = $("#addModal .form input[name='schedule_conf_FIX_RATE']").val();
} else if (scheduleType == 'FIX_DELAY') {
scheduleConf = $("#addModal .form input[name='schedule_conf_FIX_DELAY']").val();
}
$("#addModal .form input[name='scheduleConf']").val( scheduleConf );
$.post(base_url + "/jobinfo/add", $("#addModal .form").serialize(), function(data, status) {
if (data.code == "200") {
@ -468,6 +478,13 @@ $(function() {
$("#addModal .form input[name='executorHandler']").removeAttr("readonly");
});
// scheduleType change
$(".scheduleType").change(function(){
var scheduleType = $(this).val();
$(this).parents("form").find(".schedule_conf").hide();
$(this).parents("form").find(".schedule_conf_" + scheduleType).show();
});
// glueType change
$(".glueType").change(function(){
@ -508,27 +525,46 @@ $(function() {
var id = $(this).parents('ul').attr("_id");
var row = tableData['key'+id];
// base data
// fill base
$("#updateModal .form input[name='id']").val( row.id );
$('#updateModal .form select[name=jobGroup] option[value='+ row.jobGroup +']').prop('selected', true);
$("#updateModal .form input[name='jobDesc']").val( row.jobDesc );
$("#updateModal .form input[name='jobCron']").val( row.jobCron );
$("#updateModal .form input[name='author']").val( row.author );
$("#updateModal .form input[name='alarmEmail']").val( row.alarmEmail );
$("#updateModal .form input[name='executorTimeout']").val( row.executorTimeout );
$("#updateModal .form input[name='executorFailRetryCount']").val( row.executorFailRetryCount );
$('#updateModal .form select[name=executorRouteStrategy] option[value='+ row.executorRouteStrategy +']').prop('selected', true);
// fill trigger
$('#updateModal .form select[name=scheduleType] option[value='+ row.scheduleType +']').prop('selected', true);
$("#updateModal .form input[name='scheduleConf']").val( row.scheduleConf );
if (row.scheduleType == 'CRON') {
$("#updateModal .form input[name='schedule_conf_CRON']").val( row.scheduleConf );
} else if (row.scheduleType == 'FIX_RATE') {
$("#updateModal .form input[name='schedule_conf_FIX_RATE']").val( row.scheduleConf );
} else if (row.scheduleType == 'FIX_DELAY') {
$("#updateModal .form input[name='schedule_conf_FIX_DELAY']").val( row.scheduleConf );
}
// init scheduleType
$("#updateModal .form select[name=scheduleType]").change();
// fill job
$('#updateModal .form select[name=glueType] option[value='+ row.glueType +']').prop('selected', true);
$("#updateModal .form input[name='executorHandler']").val( row.executorHandler );
$("#updateModal .form textarea[name='executorParam']").val( row.executorParam );
$("#updateModal .form input[name='childJobId']").val( row.childJobId );
$('#updateModal .form select[name=executorBlockStrategy] option[value='+ row.executorBlockStrategy +']').prop('selected', true);
$('#updateModal .form select[name=glueType] option[value='+ row.glueType +']').prop('selected', true);
// init glueType
$("#updateModal .form select[name=glueType]").change();
// init-cronGen
$("#updateModal .form input[name='jobCron']").show().siblings().remove();
$("#updateModal .form input[name='jobCron']").cronGen({});
// init-cronGen
$("#updateModal .form input[name='schedule_conf_CRON']").show().siblings().remove();
$("#updateModal .form input[name='schedule_conf_CRON']").cronGen({});
// fill advanced
$('#updateModal .form select[name=executorRouteStrategy] option[value='+ row.executorRouteStrategy +']').prop('selected', true);
$("#updateModal .form input[name='childJobId']").val( row.childJobId );
$('#updateModal .form select[name=misfireStrategy] option[value='+ row.misfireStrategy +']').prop('selected', true);
$('#updateModal .form select[name=executorBlockStrategy] option[value='+ row.executorBlockStrategy +']').prop('selected', true);
$("#updateModal .form input[name='executorTimeout']").val( row.executorTimeout );
$("#updateModal .form input[name='executorFailRetryCount']").val( row.executorFailRetryCount );
// show
$('#updateModal').modal({backdrop: false, keyboard: false}).modal('show');
@ -548,12 +584,6 @@ $(function() {
},
author : {
required : true
},
executorTimeout : {
digits:true
},
executorFailRetryCount : {
digits:true
}
},
messages : {
@ -565,12 +595,6 @@ $(function() {
},
author : {
required : I18n.system_please_input + I18n.jobinfo_field_author
},
executorTimeout : {
digits: I18n.system_please_input + I18n.system_digits
},
executorFailRetryCount : {
digits: I18n.system_please_input + I18n.system_digits
}
},
highlight : function(element) {
@ -585,7 +609,7 @@ $(function() {
},
submitHandler : function(form) {
// process
// process executorTimeout + executorFailRetryCount
var executorTimeout = $("#updateModal .form input[name='executorTimeout']").val();
if(!/^\d+$/.test(executorTimeout)) {
executorTimeout = 0;
@ -597,8 +621,18 @@ $(function() {
}
$("#updateModal .form input[name='executorFailRetryCount']").val(executorFailRetryCount);
// process-cronGen
$("#updateModal .form input[name='jobCron']").val( $("#updateModal .form input[name='cronGen_display']").val() );
// process schedule_conf
var scheduleType = $("#updateModal .form select[name='scheduleType']").val();
var scheduleConf;
if (scheduleType == 'CRON') {
scheduleConf = $("#updateModal .form input[name='cronGen_display']").val();
} else if (scheduleType == 'FIX_RATE') {
scheduleConf = $("#updateModal .form input[name='schedule_conf_FIX_RATE']").val();
} else if (scheduleType == 'FIX_DELAY') {
scheduleConf = $("#updateModal .form input[name='schedule_conf_FIX_DELAY']").val();
}
$("#updateModal .form input[name='scheduleConf']").val( scheduleConf );
// post
$.post(base_url + "/jobinfo/update", $("#updateModal .form").serialize(), function(data, status) {
@ -653,27 +687,45 @@ $(function() {
var id = $(this).parents('ul').attr("_id");
var row = tableData['key'+id];
// base data
//$("#addModal .form input[name='id']").val( row.id );
// fill base
$('#addModal .form select[name=jobGroup] option[value='+ row.jobGroup +']').prop('selected', true);
$("#addModal .form input[name='jobDesc']").val( row.jobDesc );
$("#addModal .form input[name='jobCron']").val( row.jobCron );
$("#addModal .form input[name='author']").val( row.author );
$("#addModal .form input[name='alarmEmail']").val( row.alarmEmail );
$("#addModal .form input[name='executorTimeout']").val( row.executorTimeout );
$("#addModal .form input[name='executorFailRetryCount']").val( row.executorFailRetryCount );
$('#addModal .form select[name=executorRouteStrategy] option[value='+ row.executorRouteStrategy +']').prop('selected', true);
// fill trigger
$('#addModal .form select[name=scheduleType] option[value='+ row.scheduleType +']').prop('selected', true);
$("#addModal .form input[name='scheduleConf']").val( row.scheduleConf );
if (row.scheduleType == 'CRON') {
$("#addModal .form input[name='schedule_conf_CRON']").val( row.scheduleConf );
} else if (row.scheduleType == 'FIX_RATE') {
$("#addModal .form input[name='schedule_conf_FIX_RATE']").val( row.scheduleConf );
} else if (row.scheduleType == 'FIX_DELAY') {
$("#addModal .form input[name='schedule_conf_FIX_DELAY']").val( row.scheduleConf );
}
// init scheduleType
$("#addModal .form select[name=scheduleType]").change();
// fill job
$('#addModal .form select[name=glueType] option[value='+ row.glueType +']').prop('selected', true);
$("#addModal .form input[name='executorHandler']").val( row.executorHandler );
$("#addModal .form textarea[name='executorParam']").val( row.executorParam );
$("#addModal .form input[name='childJobId']").val( row.childJobId );
$('#addModal .form select[name=executorBlockStrategy] option[value='+ row.executorBlockStrategy +']').prop('selected', true);
$('#addModal .form select[name=glueType] option[value='+ row.glueType +']').prop('selected', true);
// init glueType
$("#addModal .form select[name=glueType]").change();
// init-cronGen
$("#addModal .form input[name='jobCron']").show().siblings().remove();
$("#addModal .form input[name='jobCron']").cronGen({});
// init-cronGen
$("#addModal .form input[name='schedule_conf_CRON']").show().siblings().remove();
$("#addModal .form input[name='schedule_conf_CRON']").cronGen({});
// fill advanced
$('#addModal .form select[name=executorRouteStrategy] option[value='+ row.executorRouteStrategy +']').prop('selected', true);
$("#addModal .form input[name='childJobId']").val( row.childJobId );
$('#addModal .form select[name=misfireStrategy] option[value='+ row.misfireStrategy +']').prop('selected', true);
$('#addModal .form select[name=executorBlockStrategy] option[value='+ row.executorBlockStrategy +']').prop('selected', true);
$("#addModal .form input[name='executorTimeout']").val( row.executorTimeout );
$("#addModal .form input[name='executorFailRetryCount']").val( row.executorFailRetryCount );
// show
$('#addModal').modal({backdrop: false, keyboard: false}).modal('show');

View File

@ -81,8 +81,8 @@
<th name="jobGroup" >${I18n.jobinfo_field_jobgroup}</th>
<th name="jobDesc" >${I18n.jobinfo_field_jobdesc}</th>
<th name="glueType" >${I18n.jobinfo_field_gluetype}</th>
<th name="scheduleType" >${I18n.schedule_type}</th>
<th name="executorParam" >${I18n.jobinfo_field_executorparam}</th>
<th name="jobCron" >Cron</th>
<th name="addTime" >addTime</th>
<th name="updateTime" >updateTime</th>
<th name="author" >${I18n.jobinfo_field_author}</th>
@ -114,6 +114,8 @@
</div>
<div class="modal-body">
<form class="form-horizontal form" role="form" >
<p style="margin: 0 0 10px;text-align: center;color: gray;">- ${I18n.jobinfo_conf_base} -</p> <#-- 基础信息 -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_jobgroup}<font color="red">*</font></label>
<div class="col-sm-4">
@ -123,21 +125,47 @@
</#list>
</select>
</div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_jobdesc}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobDesc" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_jobdesc}" maxlength="50" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorRouteStrategy}<font color="red">*</font></label>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_author}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="author" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_author}" maxlength="50" ></div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_alarmemail}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="${I18n.jobinfo_field_alarmemail_placeholder}" maxlength="100" ></div>
</div>
<p style="margin: 0 0 10px;text-align: center;color: gray;">- ${I18n.jobinfo_conf_trigger} -</p> <#-- 触发配置 -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.schedule_type}<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="executorRouteStrategy" >
<#list ExecutorRouteStrategyEnum as item>
<option value="${item}" >${item.title}</option>
<select class="form-control scheduleType" name="scheduleType" >
<#list ScheduleTypeEnum as item>
<option value="${item}" <#if 'CRON' == item >selected</#if> >${item.title}</option>
</#list>
</select>
</div>
<label for="lastname" class="col-sm-2 control-label">Cron<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobCron" placeholder="${I18n.system_please_input}Cron" maxlength="128" ></div>
<input type="hidden" name="scheduleConf" />
<div class="schedule_conf schedule_conf_NONE" style="display: none" >
</div>
<div class="schedule_conf schedule_conf_CRON" >
<label for="lastname" class="col-sm-2 control-label">Cron<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_CRON" placeholder="${I18n.system_please_input}Cron" maxlength="128" ></div>
</div>
<div class="schedule_conf schedule_conf_FIX_RATE" style="display: none" >
<label for="lastname" class="col-sm-2 control-label">${I18n.schedule_type_fix_rate}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_FIX_RATE" placeholder="${I18n.system_please_input} Second " maxlength="10" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
</div>
<div class="schedule_conf schedule_conf_FIX_DELAY" style="display: none" >
<label for="lastname" class="col-sm-2 control-label">${I18n.schedule_type_fix_delay}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_FIX_DELAY" placeholder="${I18n.system_please_input} Second " maxlength="10" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
</div>
</div>
<p style="margin: 0 0 10px;text-align: center;color: gray;">- ${I18n.jobinfo_conf_job} -</p> <#-- 任务配置 -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_gluetype}<font color="red">*</font></label>
<div class="col-sm-4">
@ -150,8 +178,41 @@
<label for="firstname" class="col-sm-2 control-label">JobHandler<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorHandler" placeholder="${I18n.system_please_input}JobHandler" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorBlockStrategy}<font color="red">*</font></label>
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorparam}<font color="black">*</font></label>
<div class="col-sm-10">
<textarea class="textarea form-control" name="executorParam" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_executorparam}" maxlength="512" style="height: 63px; line-height: 1.2;"></textarea>
</div>
</div>
<p style="margin: 0 0 10px;text-align: center;color: gray;">- ${I18n.jobinfo_conf_advanced} -</p> <#-- 高级配置 -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorRouteStrategy}<font color="black">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="executorRouteStrategy" >
<#list ExecutorRouteStrategyEnum as item>
<option value="${item}" >${item.title}</option>
</#list>
</select>
</div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_childJobId}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="childJobId" placeholder="${I18n.jobinfo_field_childJobId_placeholder}" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.misfire_strategy}<font color="black">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="misfireStrategy" >
<#list MisfireStrategyEnum as item>
<option value="${item}" <#if 'DO_NOTHING' == item >selected</#if> >${item.title}</option>
</#list>
</select>
</div>
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorBlockStrategy}<font color="black">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="executorBlockStrategy" >
<#list ExecutorBlockStrategyEnum as item>
@ -159,26 +220,13 @@
</#list>
</select>
</div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_childJobId}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="childJobId" placeholder="${I18n.jobinfo_field_childJobId_placeholder}" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_timeout}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorTimeout" placeholder="${I18n.jobinfo_field_executorTimeout_placeholder}" maxlength="6" ></div>
<div class="col-sm-4"><input type="text" class="form-control" name="executorTimeout" placeholder="${I18n.jobinfo_field_executorTimeout_placeholder}" maxlength="6" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorFailRetryCount}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorFailRetryCount" placeholder="${I18n.jobinfo_field_executorFailRetryCount_placeholder}" maxlength="4" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_author}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="author" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_author}" maxlength="50" ></div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_alarmemail}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="${I18n.jobinfo_field_alarmemail_placeholder}" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorparam}<font color="black">*</font></label>
<div class="col-sm-10">
<textarea class="textarea form-control" name="executorParam" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_executorparam}" maxlength="512" style="height: 63px; line-height: 1.2;"></textarea>
</div>
<div class="col-sm-4"><input type="text" class="form-control" name="executorFailRetryCount" placeholder="${I18n.jobinfo_field_executorFailRetryCount_placeholder}" maxlength="4" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
</div>
<hr>
@ -310,6 +358,10 @@ exit 0
</div>
<div class="modal-body">
<form class="form-horizontal form" role="form" >
<p style="margin: 0 0 10px;text-align: center;color: gray;">- ${I18n.jobinfo_conf_base} -</p> <#-- 基础信息 -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_jobgroup}<font color="red">*</font></label>
<div class="col-sm-4">
@ -319,21 +371,47 @@ exit 0
</#list>
</select>
</div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_jobdesc}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobDesc" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_jobdesc}" maxlength="50" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorRouteStrategy}<font color="red">*</font></label>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_author}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="author" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_author}" maxlength="50" ></div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_alarmemail}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="${I18n.jobinfo_field_alarmemail_placeholder}" maxlength="100" ></div>
</div>
<p style="margin: 0 0 10px;text-align: center;color: gray;">- ${I18n.jobinfo_conf_trigger} -</p> <#-- 触发配置 -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.schedule_type}<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="executorRouteStrategy" >
<#list ExecutorRouteStrategyEnum as item>
<select class="form-control scheduleType" name="scheduleType" >
<#list ScheduleTypeEnum as item>
<option value="${item}" >${item.title}</option>
</#list>
</select>
</div>
<label for="lastname" class="col-sm-2 control-label">Cron<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobCron" placeholder="${I18n.system_please_input}Cron" maxlength="128" ></div>
<input type="hidden" name="scheduleConf" />
<div class="schedule_conf schedule_conf_NONE" style="display: none" >
</div>
<div class="schedule_conf schedule_conf_CRON" >
<label for="lastname" class="col-sm-2 control-label">Cron<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_CRON" placeholder="${I18n.system_please_input}Cron" maxlength="128" ></div>
</div>
<div class="schedule_conf schedule_conf_FIX_RATE" style="display: none" >
<label for="lastname" class="col-sm-2 control-label">${I18n.schedule_type_fix_rate}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_FIX_RATE" placeholder="${I18n.system_please_input} Second " maxlength="10" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
</div>
<div class="schedule_conf schedule_conf_FIX_DELAY" style="display: none" >
<label for="lastname" class="col-sm-2 control-label">${I18n.schedule_type_fix_delay}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="schedule_conf_FIX_DELAY" placeholder="${I18n.system_please_input} Second " maxlength="10" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
</div>
</div>
<p style="margin: 0 0 10px;text-align: center;color: gray;">- ${I18n.jobinfo_conf_job} -</p> <#-- 任务配置 -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_gluetype}<font color="red">*</font></label>
<div class="col-sm-4">
@ -346,7 +424,40 @@ exit 0
<label for="firstname" class="col-sm-2 control-label">JobHandler<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorHandler" placeholder="${I18n.system_please_input}JobHandler" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorparam}<font color="black">*</font></label>
<div class="col-sm-10">
<textarea class="textarea form-control" name="executorParam" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_executorparam}" maxlength="512" style="height: 63px; line-height: 1.2;"></textarea>
</div>
</div>
<p style="margin: 0 0 10px;text-align: center;color: gray;">- ${I18n.jobinfo_conf_advanced} -</p> <#-- 高级配置 -->
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorRouteStrategy}<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="executorRouteStrategy" >
<#list ExecutorRouteStrategyEnum as item>
<option value="${item}" >${item.title}</option>
</#list>
</select>
</div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_childJobId}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="childJobId" placeholder="${I18n.jobinfo_field_childJobId_placeholder}" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.misfire_strategy}<font color="black">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="misfireStrategy" >
<#list MisfireStrategyEnum as item>
<option value="${item}" <#if 'DO_NOTHING' == item >selected</#if> >${item.title}</option>
</#list>
</select>
</div>
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorBlockStrategy}<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="executorBlockStrategy" >
@ -355,26 +466,13 @@ exit 0
</#list>
</select>
</div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_childJobId}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="childJobId" placeholder="${I18n.jobinfo_field_childJobId_placeholder}" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_timeout}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorTimeout" placeholder="${I18n.jobinfo_field_executorTimeout_placeholder}" maxlength="6" ></div>
<div class="col-sm-4"><input type="text" class="form-control" name="executorTimeout" placeholder="${I18n.jobinfo_field_executorTimeout_placeholder}" maxlength="6" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorFailRetryCount}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorFailRetryCount" placeholder="${I18n.jobinfo_field_executorFailRetryCount_placeholder}" maxlength="4" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_author}<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="author" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_author}" maxlength="50" ></div>
<label for="lastname" class="col-sm-2 control-label">${I18n.jobinfo_field_alarmemail}<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="${I18n.jobinfo_field_alarmemail_placeholder}" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">${I18n.jobinfo_field_executorparam}<font color="black">*</font></label>
<div class="col-sm-10">
<textarea class="textarea form-control" name="executorParam" placeholder="${I18n.system_please_input}${I18n.jobinfo_field_executorparam}" maxlength="512" style="height: 63px; line-height: 1.2;"></textarea>
</div>
<div class="col-sm-4"><input type="text" class="form-control" name="executorFailRetryCount" placeholder="${I18n.jobinfo_field_executorFailRetryCount_placeholder}" maxlength="4" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" ></div>
</div>
<hr>

View File

@ -1,6 +1,8 @@
package com.xxl.job.admin.dao;
import com.xxl.job.admin.core.model.XxlJobInfo;
import com.xxl.job.admin.core.scheduler.MisfireStrategyEnum;
import com.xxl.job.admin.core.scheduler.ScheduleTypeEnum;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
@ -32,10 +34,12 @@ public class XxlJobInfoDaoTest {
public void save_load(){
XxlJobInfo info = new XxlJobInfo();
info.setJobGroup(1);
info.setJobCron("jobCron");
info.setJobDesc("desc");
info.setAuthor("setAuthor");
info.setAlarmEmail("setAlarmEmail");
info.setScheduleType(ScheduleTypeEnum.FIX_RATE.name());
info.setScheduleConf(String.valueOf(33));
info.setMisfireStrategy(MisfireStrategyEnum.DO_NOTHING.name());
info.setExecutorRouteStrategy("setExecutorRouteStrategy");
info.setExecutorHandler("setExecutorHandler");
info.setExecutorParam("setExecutorParam");
@ -52,7 +56,9 @@ public class XxlJobInfoDaoTest {
int count = xxlJobInfoDao.save(info);
XxlJobInfo info2 = xxlJobInfoDao.loadById(info.getId());
info2.setJobCron("jobCron2");
info.setScheduleType(ScheduleTypeEnum.FIX_DELAY.name());
info.setScheduleConf(String.valueOf(44));
info.setMisfireStrategy(MisfireStrategyEnum.FIRE_ONCE_NOW.name());
info2.setJobDesc("desc2");
info2.setAuthor("setAuthor2");
info2.setAlarmEmail("setAlarmEmail2");