规范项目目录,方便扩展多执行器;

master
xuxueli 7 years ago
parent 0cb742d63d
commit 85179937cc
  1. 2
      NOTICE
  2. 2
      README.md
  3. 0
      doc/XXL-JOB-English-Documentation.md
  4. 37
      doc/XXL-JOB官方文档.md
  5. 0
      doc/db/tables_mysql(备份,请忽略).sql
  6. 440
      doc/db/tables_xxl_job.sql
  7. 3
      pom.xml
  8. 4
      xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java
  9. 2
      xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java
  10. 18
      xxl-job-executor-samples/pom.xml
  11. 76
      xxl-job-executor-samples/xxl-job-executor-sample-spring/pom.xml
  12. 76
      xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
  13. 0
      xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java
  14. 80
      xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/applicationcontext-xxl-job.xml
  15. 6
      xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/log4j.xml
  16. 2
      xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/xxl-job-executor.properties
  17. 52
      xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/webapp/WEB-INF/web.xml
  18. 0
      xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/webapp/index.html
  19. 0
      xxl-job-executor-samples/xxl-job-executor-sample-spring/src/test/java/com/xxl/executor/test/DemoJobHandlerTest.java
  20. 4
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/pom.xml
  21. 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/Application.java
  22. 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java
  23. 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java
  24. 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
  25. 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java
  26. 2
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties
  27. 2
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/logback.xml
  28. 0
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/test/java/com/xxl/job/executor/test/XxlJobExecutorExampleBootApplicationTests.java

@ -1,4 +1,4 @@
Copyright 2015-2017/NOW xuxueli. Copyright (c) 2015-present, xuxueli.
Dependencies: Dependencies:
================================================================ ================================================================

@ -38,7 +38,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
## Documentation ## Documentation
- [中文文档](https://github.com/xuxueli/xxl-job/blob/master/doc/XXL-JOB官方文档.md) - [中文文档](https://github.com/xuxueli/xxl-job/blob/master/doc/XXL-JOB官方文档.md)
- [Englis Documentation](https://github.com/xuxueli/xxl-job/blob/master/doc/XXL-JOB-Englis-Documentation.md) - [English Documentation](https://github.com/xuxueli/xxl-job/blob/master/doc/XXL-JOB-English-Documentation.md)
## Features ## Features

@ -122,11 +122,11 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
#### 技术交流 #### 技术交流
- 腾讯QQ群(6):399758605 - 腾讯QQ群(6):399758605
- 腾讯QQ群(5):138274130 (群即将满,请加群6) - 腾讯QQ群(5):138274130
- 腾讯QQ群(4):464762661 (群即将满,请加群6) - 腾讯QQ群(4):464762661
- 腾讯QQ群(3):242151780 (群即将满,请加群6) - 腾讯QQ群(3):242151780
- 腾讯QQ群(2):438249535 (群即将满,请加群6) - 腾讯QQ群(2):438249535
- 腾讯QQ群(1):367260654 (群即将满,请加群6) - 腾讯QQ群(1):367260654
### 1.5 环境 ### 1.5 环境
- JDK:1.7+ - JDK:1.7+
@ -144,7 +144,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
"调度数据库初始化SQL脚本" 位置为: "调度数据库初始化SQL脚本" 位置为:
/xxl-job/db/tables_xxl_job.sql /xxl-job/doc/db/tables_xxl_job.sql
调度中心支持集群部署,集群情况下各节点务必连接同一个mysql实例; 调度中心支持集群部署,集群情况下各节点务必连接同一个mysql实例;
@ -155,8 +155,9 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
xxl-job-admin:调度中心 xxl-job-admin:调度中心
xxl-job-core:公共依赖 xxl-job-core:公共依赖
xxl-job-executor-example:执行器Example(可直接使用执行器Example,也可以将现有项目改造成执行器使用) xxl-job-executor:执行器Example项目
xxl-job-executor-springboot-example:执行器Example,springboot版本 :xxl-job-executor-sample-spring:执行器Example,Spring版本(可直接使用执行器Example,也可以将现有项目改造成执行器使用)
:xxl-job-executor-sample-springboot:执行器Example,Springboot版本
### 2.3 配置部署“调度中心” ### 2.3 配置部署“调度中心”
@ -209,7 +210,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
### 2.4 配置部署“执行器项目” ### 2.4 配置部署“执行器项目”
“执行器”项目:xxl-job-executor-example (如新建执行器项目,可参考该Example执行器项目的配置步骤;) “执行器”项目:xxl-job-executor-sample-spring (如新建执行器项目,可参考该Example执行器项目的配置步骤;)
作用:负责接收“调度中心”的调度并执行; 作用:负责接收“调度中心”的调度并执行;
#### 步骤一:maven依赖 #### 步骤一:maven依赖
@ -218,7 +219,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
#### 步骤二:执行器配置 #### 步骤二:执行器配置
执行器配置配置文件地址: 执行器配置配置文件地址:
/xxl-job/xxl-job-executor-example/src/main/resources/xxl-job-executor.properties /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/xxl-job-executor.properties
执行器配置配置内容说明: 执行器配置配置内容说明:
@ -226,7 +227,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
### xxl-job executor address:执行器"AppName"和地址信息配置:AppName执行器心跳注册分组依据;地址信息用于"调度中心请求并触发任务"和"执行器注册"。执行器默认端口为9999,执行器IP默认为空表示自动获取IP,多网卡时可手动设置指定IP。单机部署多个执行器时,注意要配置不同执行器端口; ### xxl-job executor address:执行器"AppName"和地址信息配置:AppName执行器心跳注册分组依据;地址信息用于"调度中心请求并触发任务"和"执行器注册"。执行器默认端口为9999,执行器IP默认为空表示自动获取IP,多网卡时可手动设置指定IP。单机部署多个执行器时,注意要配置不同执行器端口;
xxl.job.executor.appname=xxl-job-executor-example xxl.job.executor.appname=xxl-job-executor-sample
xxl.job.executor.ip= xxl.job.executor.ip=
xxl.job.executor.port=9999 xxl.job.executor.port=9999
@ -248,8 +249,8 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
#### 步骤四:部署执行器项目: #### 步骤四:部署执行器项目:
如果已经正确进行上述配置,可将执行器项目编译打部署,系统提供两个执行器example项目,选择其中一个即可,各自的部署方式如下。 如果已经正确进行上述配置,可将执行器项目编译打部署,系统提供两个执行器example项目,选择其中一个即可,各自的部署方式如下。
xxl-job-executor-example:项目编译打包成WAR包,并部署到tomcat中。 xxl-job-executor-sample-spring:项目编译打包成WAR包,并部署到tomcat中。
xxl-job-executor-springboot-example:项目编译打包成springboot类型的可执行JAR包,命令启动即可; xxl-job-executor-sample-springboot:项目编译打包成springboot类型的可执行JAR包,命令启动即可;
至此“执行器”项目已经部署结束。 至此“执行器”项目已经部署结束。
@ -326,7 +327,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
- 失败处理策略;调度失败时的处理策略; - 失败处理策略;调度失败时的处理策略;
失败告警(默认):调度失败时,将会触发失败报警,如发送报警邮件; 失败告警(默认):调度失败时,将会触发失败报警,如发送报警邮件;
失败重试:调度失败时,将会主动进行一次失败重试调度,重试调度后仍然失败将会触发一失败告警。注意当任务以failover方式路由时,每次失败重试将会触发新一轮路由。 失败重试:调度失败时,将会主动进行一次失败重试调度,重试调度后仍然失败将会触发一失败告警。注意当任务以failover方式路由时,每次失败重试将会触发新一轮路由。
- 执行参数:任务执行所需的参数,多个参数时用逗号分隔,任务执行时将会把多个参数换成数组传入; - 执行参数:任务执行所需的参数,多个参数时用逗号分隔,任务执行时将会把多个参数换成数组传入;
- 报警邮件:任务调度失败时邮件通知的邮箱地址,支持配置多邮箱地址,配置多个邮箱地址时用逗号分隔; - 报警邮件:任务调度失败时邮件通知的邮箱地址,支持配置多邮箱地址,配置多个邮箱地址时用逗号分隔;
- 负责人:任务的负责人; - 负责人:任务的负责人;
@ -337,7 +338,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
- 1、 新建一个继承com.xxl.job.core.handler.IJobHandler的Java类; - 1、 新建一个继承com.xxl.job.core.handler.IJobHandler的Java类;
- 2、 该类被Spring容器扫描为Bean实例,如加“@Component”注解; - 2、 该类被Spring容器扫描为Bean实例,如加“@Component”注解;
- 3、 添加 “@JobHander(value="自定义jobhandler名称")”注解,注解的value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。 - 3、 添加 “@JobHander(value="自定义jobhandler名称")”注解,注解的value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。
(可参考xxl-job-executor-example项目中的DemoJobHandler,见下图) (可参考Example执行器中的DemoJobHandler,见下图)
![输入图片说明](https://static.oschina.net/uploads/img/201607/23232347_oLlM.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/23232347_oLlM.png "在这里输入图片标题")
@ -495,7 +496,7 @@ try{
- /db :“调度数据库”建表脚本 - /db :“调度数据库”建表脚本
- /xxl-job-admin :调度中心,项目源码 - /xxl-job-admin :调度中心,项目源码
- /xxl-job-core :公共Jar依赖 - /xxl-job-core :公共Jar依赖
- /xxl-job-executor-example :执行器,Demo项目源码(大家可以在该项目上进行开发,也可以将现有项目改造生成执行器项目) - /xxl-job-executor-samples :执行器,Example项目(大家可以在该项目上进行开发,也可以将现有项目改造生成执行器项目)
#### 5.2 “调度数据库”配置 #### 5.2 “调度数据库”配置
XXL-JOB调度模块基于Quartz集群实现,其“调度数据库”是在Quartz的11张集群mysql表基础上扩展而成。 XXL-JOB调度模块基于Quartz集群实现,其“调度数据库”是在Quartz的11张集群mysql表基础上扩展而成。
@ -944,6 +945,10 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 10、springboot版本执行器,升级至1.5.6.RELEASE版本; - 10、springboot版本执行器,升级至1.5.6.RELEASE版本;
- 11、统一maven依赖版本管理; - 11、统一maven依赖版本管理;
#### 6.18 版本 V1.8.2 特性[Coding]
- 1、解决执行器回调URL不支持配置HTTPS时问题;
- 2、规范项目目录,方便扩展多执行器;
#### TODO LIST #### TODO LIST
- 1、任务权限管理:执行器为粒度分配权限,核心操作校验权限; - 1、任务权限管理:执行器为粒度分配权限,核心操作校验权限;
- 2、任务分片路由:分片采用一致性Hash算法计算出尽量稳定的分片顺序,即使注册机器存在波动也不会引起分批分片顺序大的波动;目前采用IP自然排序,可以满足需求,待定; - 2、任务分片路由:分片采用一致性Hash算法计算出尽量稳定的分片顺序,即使注册机器存在波动也不会引起分批分片顺序大的波动;目前采用IP自然排序,可以满足需求,待定;

@ -1,220 +1,220 @@
CREATE TABLE XXL_JOB_QRTZ_JOB_DETAILS CREATE TABLE XXL_JOB_QRTZ_JOB_DETAILS
( (
SCHED_NAME VARCHAR(120) NOT NULL, SCHED_NAME VARCHAR(120) NOT NULL,
JOB_NAME VARCHAR(200) NOT NULL, JOB_NAME VARCHAR(200) NOT NULL,
JOB_GROUP VARCHAR(200) NOT NULL, JOB_GROUP VARCHAR(200) NOT NULL,
DESCRIPTION VARCHAR(250) NULL, DESCRIPTION VARCHAR(250) NULL,
JOB_CLASS_NAME VARCHAR(250) NOT NULL, JOB_CLASS_NAME VARCHAR(250) NOT NULL,
IS_DURABLE VARCHAR(1) NOT NULL, IS_DURABLE VARCHAR(1) NOT NULL,
IS_NONCONCURRENT VARCHAR(1) NOT NULL, IS_NONCONCURRENT VARCHAR(1) NOT NULL,
IS_UPDATE_DATA VARCHAR(1) NOT NULL, IS_UPDATE_DATA VARCHAR(1) NOT NULL,
REQUESTS_RECOVERY VARCHAR(1) NOT NULL, REQUESTS_RECOVERY VARCHAR(1) NOT NULL,
JOB_DATA BLOB NULL, JOB_DATA BLOB NULL,
PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP) PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
); );
CREATE TABLE XXL_JOB_QRTZ_TRIGGERS CREATE TABLE XXL_JOB_QRTZ_TRIGGERS
( (
SCHED_NAME VARCHAR(120) NOT NULL, SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL, TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL, TRIGGER_GROUP VARCHAR(200) NOT NULL,
JOB_NAME VARCHAR(200) NOT NULL, JOB_NAME VARCHAR(200) NOT NULL,
JOB_GROUP VARCHAR(200) NOT NULL, JOB_GROUP VARCHAR(200) NOT NULL,
DESCRIPTION VARCHAR(250) NULL, DESCRIPTION VARCHAR(250) NULL,
NEXT_FIRE_TIME BIGINT(13) NULL, NEXT_FIRE_TIME BIGINT(13) NULL,
PREV_FIRE_TIME BIGINT(13) NULL, PREV_FIRE_TIME BIGINT(13) NULL,
PRIORITY INTEGER NULL, PRIORITY INTEGER NULL,
TRIGGER_STATE VARCHAR(16) NOT NULL, TRIGGER_STATE VARCHAR(16) NOT NULL,
TRIGGER_TYPE VARCHAR(8) NOT NULL, TRIGGER_TYPE VARCHAR(8) NOT NULL,
START_TIME BIGINT(13) NOT NULL, START_TIME BIGINT(13) NOT NULL,
END_TIME BIGINT(13) NULL, END_TIME BIGINT(13) NULL,
CALENDAR_NAME VARCHAR(200) NULL, CALENDAR_NAME VARCHAR(200) NULL,
MISFIRE_INSTR SMALLINT(2) NULL, MISFIRE_INSTR SMALLINT(2) NULL,
JOB_DATA BLOB NULL, JOB_DATA BLOB NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP) FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
REFERENCES XXL_JOB_QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP) REFERENCES XXL_JOB_QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)
); );
CREATE TABLE XXL_JOB_QRTZ_SIMPLE_TRIGGERS CREATE TABLE XXL_JOB_QRTZ_SIMPLE_TRIGGERS
( (
SCHED_NAME VARCHAR(120) NOT NULL, SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL, TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL, TRIGGER_GROUP VARCHAR(200) NOT NULL,
REPEAT_COUNT BIGINT(7) NOT NULL, REPEAT_COUNT BIGINT(7) NOT NULL,
REPEAT_INTERVAL BIGINT(12) NOT NULL, REPEAT_INTERVAL BIGINT(12) NOT NULL,
TIMES_TRIGGERED BIGINT(10) NOT NULL, TIMES_TRIGGERED BIGINT(10) NOT NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
); );
CREATE TABLE XXL_JOB_QRTZ_CRON_TRIGGERS CREATE TABLE XXL_JOB_QRTZ_CRON_TRIGGERS
( (
SCHED_NAME VARCHAR(120) NOT NULL, SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL, TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL, TRIGGER_GROUP VARCHAR(200) NOT NULL,
CRON_EXPRESSION VARCHAR(200) NOT NULL, CRON_EXPRESSION VARCHAR(200) NOT NULL,
TIME_ZONE_ID VARCHAR(80), TIME_ZONE_ID VARCHAR(80),
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
); );
CREATE TABLE XXL_JOB_QRTZ_SIMPROP_TRIGGERS CREATE TABLE XXL_JOB_QRTZ_SIMPROP_TRIGGERS
( (
SCHED_NAME VARCHAR(120) NOT NULL, SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL, TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL, TRIGGER_GROUP VARCHAR(200) NOT NULL,
STR_PROP_1 VARCHAR(512) NULL, STR_PROP_1 VARCHAR(512) NULL,
STR_PROP_2 VARCHAR(512) NULL, STR_PROP_2 VARCHAR(512) NULL,
STR_PROP_3 VARCHAR(512) NULL, STR_PROP_3 VARCHAR(512) NULL,
INT_PROP_1 INT NULL, INT_PROP_1 INT NULL,
INT_PROP_2 INT NULL, INT_PROP_2 INT NULL,
LONG_PROP_1 BIGINT NULL, LONG_PROP_1 BIGINT NULL,
LONG_PROP_2 BIGINT NULL, LONG_PROP_2 BIGINT NULL,
DEC_PROP_1 NUMERIC(13,4) NULL, DEC_PROP_1 NUMERIC(13,4) NULL,
DEC_PROP_2 NUMERIC(13,4) NULL, DEC_PROP_2 NUMERIC(13,4) NULL,
BOOL_PROP_1 VARCHAR(1) NULL, BOOL_PROP_1 VARCHAR(1) NULL,
BOOL_PROP_2 VARCHAR(1) NULL, BOOL_PROP_2 VARCHAR(1) NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
); );
CREATE TABLE XXL_JOB_QRTZ_BLOB_TRIGGERS CREATE TABLE XXL_JOB_QRTZ_BLOB_TRIGGERS
( (
SCHED_NAME VARCHAR(120) NOT NULL, SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL, TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL, TRIGGER_GROUP VARCHAR(200) NOT NULL,
BLOB_DATA BLOB NULL, BLOB_DATA BLOB NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
); );
CREATE TABLE XXL_JOB_QRTZ_CALENDARS CREATE TABLE XXL_JOB_QRTZ_CALENDARS
( (
SCHED_NAME VARCHAR(120) NOT NULL, SCHED_NAME VARCHAR(120) NOT NULL,
CALENDAR_NAME VARCHAR(200) NOT NULL, CALENDAR_NAME VARCHAR(200) NOT NULL,
CALENDAR BLOB NOT NULL, CALENDAR BLOB NOT NULL,
PRIMARY KEY (SCHED_NAME,CALENDAR_NAME) PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)
); );
CREATE TABLE XXL_JOB_QRTZ_PAUSED_TRIGGER_GRPS CREATE TABLE XXL_JOB_QRTZ_PAUSED_TRIGGER_GRPS
( (
SCHED_NAME VARCHAR(120) NOT NULL, SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL, TRIGGER_GROUP VARCHAR(200) NOT NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP) PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)
); );
CREATE TABLE XXL_JOB_QRTZ_FIRED_TRIGGERS CREATE TABLE XXL_JOB_QRTZ_FIRED_TRIGGERS
( (
SCHED_NAME VARCHAR(120) NOT NULL, SCHED_NAME VARCHAR(120) NOT NULL,
ENTRY_ID VARCHAR(95) NOT NULL, ENTRY_ID VARCHAR(95) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL, TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL, TRIGGER_GROUP VARCHAR(200) NOT NULL,
INSTANCE_NAME VARCHAR(200) NOT NULL, INSTANCE_NAME VARCHAR(200) NOT NULL,
FIRED_TIME BIGINT(13) NOT NULL, FIRED_TIME BIGINT(13) NOT NULL,
SCHED_TIME BIGINT(13) NOT NULL, SCHED_TIME BIGINT(13) NOT NULL,
PRIORITY INTEGER NOT NULL, PRIORITY INTEGER NOT NULL,
STATE VARCHAR(16) NOT NULL, STATE VARCHAR(16) NOT NULL,
JOB_NAME VARCHAR(200) NULL, JOB_NAME VARCHAR(200) NULL,
JOB_GROUP VARCHAR(200) NULL, JOB_GROUP VARCHAR(200) NULL,
IS_NONCONCURRENT VARCHAR(1) NULL, IS_NONCONCURRENT VARCHAR(1) NULL,
REQUESTS_RECOVERY VARCHAR(1) NULL, REQUESTS_RECOVERY VARCHAR(1) NULL,
PRIMARY KEY (SCHED_NAME,ENTRY_ID) PRIMARY KEY (SCHED_NAME,ENTRY_ID)
); );
CREATE TABLE XXL_JOB_QRTZ_SCHEDULER_STATE CREATE TABLE XXL_JOB_QRTZ_SCHEDULER_STATE
( (
SCHED_NAME VARCHAR(120) NOT NULL, SCHED_NAME VARCHAR(120) NOT NULL,
INSTANCE_NAME VARCHAR(200) NOT NULL, INSTANCE_NAME VARCHAR(200) NOT NULL,
LAST_CHECKIN_TIME BIGINT(13) NOT NULL, LAST_CHECKIN_TIME BIGINT(13) NOT NULL,
CHECKIN_INTERVAL BIGINT(13) NOT NULL, CHECKIN_INTERVAL BIGINT(13) NOT NULL,
PRIMARY KEY (SCHED_NAME,INSTANCE_NAME) PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)
); );
CREATE TABLE XXL_JOB_QRTZ_LOCKS CREATE TABLE XXL_JOB_QRTZ_LOCKS
( (
SCHED_NAME VARCHAR(120) NOT NULL, SCHED_NAME VARCHAR(120) NOT NULL,
LOCK_NAME VARCHAR(40) NOT NULL, LOCK_NAME VARCHAR(40) NOT NULL,
PRIMARY KEY (SCHED_NAME,LOCK_NAME) PRIMARY KEY (SCHED_NAME,LOCK_NAME)
); );
CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_INFO` ( CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_INFO` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`job_group` int(11) NOT NULL COMMENT '执行器主键ID', `job_group` int(11) NOT NULL COMMENT '执行器主键ID',
`job_cron` varchar(128) NOT NULL COMMENT '任务执行CRON', `job_cron` varchar(128) NOT NULL COMMENT '任务执行CRON',
`job_desc` varchar(255) NOT NULL, `job_desc` varchar(255) NOT NULL,
`add_time` datetime DEFAULT NULL, `add_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL, `update_time` datetime DEFAULT NULL,
`author` varchar(64) DEFAULT NULL COMMENT '作者', `author` varchar(64) DEFAULT NULL COMMENT '作者',
`alarm_email` varchar(255) DEFAULT NULL COMMENT '报警邮件', `alarm_email` varchar(255) DEFAULT NULL COMMENT '报警邮件',
`executor_route_strategy` varchar(50) DEFAULT NULL COMMENT '执行器路由策略', `executor_route_strategy` varchar(50) DEFAULT NULL COMMENT '执行器路由策略',
`executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler', `executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler',
`executor_param` varchar(255) DEFAULT NULL COMMENT '执行器任务参数', `executor_param` varchar(255) DEFAULT NULL COMMENT '执行器任务参数',
`executor_block_strategy` varchar(50) DEFAULT NULL COMMENT '阻塞处理策略', `executor_block_strategy` varchar(50) DEFAULT NULL COMMENT '阻塞处理策略',
`executor_fail_strategy` varchar(50) DEFAULT NULL COMMENT '失败处理策略', `executor_fail_strategy` varchar(50) DEFAULT NULL COMMENT '失败处理策略',
`glue_type` varchar(50) NOT NULL COMMENT 'GLUE类型', `glue_type` varchar(50) NOT NULL COMMENT 'GLUE类型',
`glue_source` text COMMENT 'GLUE源代码', `glue_source` text COMMENT 'GLUE源代码',
`glue_remark` varchar(128) DEFAULT NULL COMMENT 'GLUE备注', `glue_remark` varchar(128) DEFAULT NULL COMMENT 'GLUE备注',
`glue_updatetime` datetime DEFAULT NULL COMMENT 'GLUE更新时间', `glue_updatetime` datetime DEFAULT NULL COMMENT 'GLUE更新时间',
`child_jobkey` varchar(255) DEFAULT NULL COMMENT '子任务Key', `child_jobkey` varchar(255) DEFAULT NULL COMMENT '子任务Key',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOG` ( CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOG` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`job_group` int(11) NOT NULL COMMENT '执行器主键ID', `job_group` int(11) NOT NULL COMMENT '执行器主键ID',
`job_id` int(11) NOT NULL COMMENT '任务,主键ID', `job_id` int(11) NOT NULL COMMENT '任务,主键ID',
`glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型', `glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型',
`executor_address` varchar(255) DEFAULT NULL COMMENT '执行器地址,本次执行的地址', `executor_address` varchar(255) DEFAULT NULL COMMENT '执行器地址,本次执行的地址',
`executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler', `executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler',
`executor_param` varchar(255) DEFAULT NULL COMMENT 'executor_param', `executor_param` varchar(255) DEFAULT NULL COMMENT 'executor_param',
`trigger_time` datetime DEFAULT NULL COMMENT '调度-时间', `trigger_time` datetime DEFAULT NULL COMMENT '调度-时间',
`trigger_code` varchar(255) NOT NULL DEFAULT '0' COMMENT '调度-结果', `trigger_code` varchar(255) NOT NULL DEFAULT '0' COMMENT '调度-结果',
`trigger_msg` varchar(2048) DEFAULT NULL COMMENT '调度-日志', `trigger_msg` varchar(2048) DEFAULT NULL COMMENT '调度-日志',
`handle_time` datetime DEFAULT NULL COMMENT '执行-时间', `handle_time` datetime DEFAULT NULL COMMENT '执行-时间',
`handle_code` varchar(255) NOT NULL DEFAULT '0' COMMENT '执行-状态', `handle_code` varchar(255) NOT NULL DEFAULT '0' COMMENT '执行-状态',
`handle_msg` varchar(2048) DEFAULT NULL COMMENT '执行-日志', `handle_msg` varchar(2048) DEFAULT NULL COMMENT '执行-日志',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOGGLUE` ( CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOGGLUE` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`job_id` int(11) NOT NULL COMMENT '任务,主键ID', `job_id` int(11) NOT NULL COMMENT '任务,主键ID',
`glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型', `glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型',
`glue_source` text COMMENT 'GLUE源代码', `glue_source` text COMMENT 'GLUE源代码',
`glue_remark` varchar(128) NOT NULL COMMENT 'GLUE备注', `glue_remark` varchar(128) NOT NULL COMMENT 'GLUE备注',
`add_time` timestamp NULL DEFAULT NULL, `add_time` timestamp NULL DEFAULT NULL,
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE XXL_JOB_QRTZ_TRIGGER_REGISTRY ( CREATE TABLE XXL_JOB_QRTZ_TRIGGER_REGISTRY (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`registry_group` varchar(255) NOT NULL, `registry_group` varchar(255) NOT NULL,
`registry_key` varchar(255) NOT NULL, `registry_key` varchar(255) NOT NULL,
`registry_value` varchar(255) NOT NULL, `registry_value` varchar(255) NOT NULL,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_GROUP` ( CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_GROUP` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`app_name` varchar(64) NOT NULL COMMENT '执行器AppName', `app_name` varchar(64) NOT NULL COMMENT '执行器AppName',
`title` varchar(12) NOT NULL COMMENT '执行器名称', `title` varchar(12) NOT NULL COMMENT '执行器名称',
`order` tinyint(4) NOT NULL DEFAULT '0' COMMENT '排序', `order` tinyint(4) NOT NULL DEFAULT '0' COMMENT '排序',
`address_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '执行器地址类型:0=自动注册、1=手动录入', `address_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '执行器地址类型:0=自动注册、1=手动录入',
`address_list` varchar(200) DEFAULT NULL COMMENT '执行器地址列表,多地址逗号分隔', `address_list` varchar(200) DEFAULT NULL COMMENT '执行器地址列表,多地址逗号分隔',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `XXL_JOB_QRTZ_TRIGGER_GROUP` ( `app_name`, `title`, `order`, `address_type`, `address_list`) values ( 'xxl-job-executor-example', '示例执行器', '1', '0', null); INSERT INTO `XXL_JOB_QRTZ_TRIGGER_GROUP` ( `app_name`, `title`, `order`, `address_type`, `address_list`) values ( 'xxl-job-executor-sample', '示例执行器', '1', '0', null);
commit; commit;

@ -13,8 +13,7 @@
<modules> <modules>
<module>xxl-job-core</module> <module>xxl-job-core</module>
<module>xxl-job-admin</module> <module>xxl-job-admin</module>
<module>xxl-job-executor-example</module> <module>xxl-job-executor-samples</module>
<module>xxl-job-executor-springboot-example</module>
</modules> </modules>
<properties> <properties>

@ -71,7 +71,9 @@ public class XxlJobExecutor implements ApplicationContextAware {
initAdminBizList(adminAddresses, accessToken); initAdminBizList(adminAddresses, accessToken);
// init executor-jobHandlerRepository // init executor-jobHandlerRepository
initJobHandlerRepository(applicationContext); if (applicationContext != null) {
initJobHandlerRepository(applicationContext);
}
// init logpath // init logpath
if (logPath!=null && logPath.trim().length()>0) { if (logPath!=null && logPath.trim().length()>0) {

@ -18,7 +18,7 @@ public class XxlJobFileAppender {
// for JobThread (support log for child thread of job handler) // for JobThread (support log for child thread of job handler)
//public static ThreadLocal<String> contextHolder = new ThreadLocal<String>(); //public static ThreadLocal<String> contextHolder = new ThreadLocal<String>();
public static final InheritableThreadLocal<String> contextHolder = new InheritableThreadLocal<String>(); public static final InheritableThreadLocal<String> contextHolder = new InheritableThreadLocal<String>();
public static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); public static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // TODO, concurrent issues
public static String logPath = "/data/applogs/xxl-job/jobhandler/"; public static String logPath = "/data/applogs/xxl-job/jobhandler/";
/** /**

@ -0,0 +1,18 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job</artifactId>
<version>1.8.2-SNAPSHOT</version>
</parent>
<artifactId>xxl-job-executor-samples</artifactId>
<packaging>pom</packaging>
<modules>
<module>xxl-job-executor-sample-spring</module>
<module>xxl-job-executor-sample-springboot</module>
</modules>
</project>

@ -1,39 +1,39 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>com.xuxueli</groupId> <groupId>com.xuxueli</groupId>
<artifactId>xxl-job</artifactId> <artifactId>xxl-job-executor-samples</artifactId>
<version>1.8.2-SNAPSHOT</version> <version>1.8.2-SNAPSHOT</version>
</parent> </parent>
<artifactId>xxl-job-executor-example</artifactId> <artifactId>xxl-job-executor-sample-spring</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<description>Executor project for spring boot.</description> <description>Executor project for spring boot.</description>
<url>http://www.xuxueli.com/</url> <url>http://www.xuxueli.com/</url>
<dependencies> <dependencies>
<!-- spring-webmvc --> <!-- spring-webmvc -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId> <artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<!-- slf4j --> <!-- slf4j -->
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId> <artifactId>slf4j-log4j12</artifactId>
<version>${slf4j-api.version}</version> <version>${slf4j-api.version}</version>
</dependency> </dependency>
<!-- xxl-job-core --> <!-- xxl-job-core -->
<dependency> <dependency>
<groupId>com.xuxueli</groupId> <groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId> <artifactId>xxl-job-core</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

@ -1,38 +1,38 @@
package com.xxl.job.executor.service.jobhandler; package com.xxl.job.executor.service.jobhandler;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler; import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHander; import com.xxl.job.core.handler.annotation.JobHander;
import com.xxl.job.core.log.XxlJobLogger; import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
* 任务Handler的一个DemoBean模式 * 任务Handler的一个DemoBean模式
* *
* 开发步骤 * 开发步骤
* 1新建一个继承com.xxl.job.core.handler.IJobHandler的Java类 * 1新建一个继承com.xxl.job.core.handler.IJobHandler的Java类
* 2该类被Spring容器扫描为Bean实例如加@Component注解 * 2该类被Spring容器扫描为Bean实例如加@Component注解
* 3添加 @JobHander(value="自定义jobhandler名称")注解注解的value值为自定义的JobHandler名称该名称对应的是调度中心新建任务的JobHandler属性的值 * 3添加 @JobHander(value="自定义jobhandler名称")注解注解的value值为自定义的JobHandler名称该名称对应的是调度中心新建任务的JobHandler属性的值
* 4执行日志需要通过 "XxlJobLogger.log" 打印执行日志 * 4执行日志需要通过 "XxlJobLogger.log" 打印执行日志
* *
* @author xuxueli 2015-12-19 19:43:36 * @author xuxueli 2015-12-19 19:43:36
*/ */
@JobHander(value="demoJobHandler") @JobHander(value="demoJobHandler")
@Component @Component
public class DemoJobHandler extends IJobHandler { public class DemoJobHandler extends IJobHandler {
@Override @Override
public ReturnT<String> execute(String... params) throws Exception { public ReturnT<String> execute(String... params) throws Exception {
XxlJobLogger.log("XXL-JOB, Hello World."); XxlJobLogger.log("XXL-JOB, Hello World.");
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
XxlJobLogger.log("beat at:" + i); XxlJobLogger.log("beat at:" + i);
TimeUnit.SECONDS.sleep(2); TimeUnit.SECONDS.sleep(2);
} }
return ReturnT.SUCCESS; return ReturnT.SUCCESS;
} }
} }

@ -1,41 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"> http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="fileEncoding" value="utf-8" /> <property name="fileEncoding" value="utf-8" />
<property name="locations"> <property name="locations">
<list> <list>
<value>classpath*:xxl-job-executor.properties</value> <value>classpath*:xxl-job-executor.properties</value>
</list> </list>
</property> </property>
</bean> </bean>
<!-- ********************************* 基础配置 ********************************* --> <!-- ********************************* 基础配置 ********************************* -->
<!-- 配置01、JobHandler 扫描路径 --> <!-- 配置01、JobHandler 扫描路径 -->
<context:component-scan base-package="com.xxl.job.executor.service.jobhandler" /> <context:component-scan base-package="com.xxl.job.executor.service.jobhandler" />
<!-- 配置02、执行器 --> <!-- 配置02、执行器 -->
<bean id="xxlJobExecutor" class="com.xxl.job.core.executor.XxlJobExecutor" init-method="start" destroy-method="destroy" > <bean id="xxlJobExecutor" class="com.xxl.job.core.executor.XxlJobExecutor" init-method="start" destroy-method="destroy" >
<!-- 执行器IP[选填],为空则自动获取 --> <!-- 执行器IP[选填],为空则自动获取 -->
<property name="ip" value="${xxl.job.executor.ip}" /> <property name="ip" value="${xxl.job.executor.ip}" />
<!-- 执行器端口号[必须] --> <!-- 执行器端口号[必须] -->
<property name="port" value="${xxl.job.executor.port}" /> <property name="port" value="${xxl.job.executor.port}" />
<!-- 执行器AppName[选填],为空则关闭自动注册 --> <!-- 执行器AppName[选填],为空则关闭自动注册 -->
<property name="appName" value="${xxl.job.executor.appname}" /> <property name="appName" value="${xxl.job.executor.appname}" />
<!-- 执行器注册中心地址[选填],为空则关闭自动注册 --> <!-- 执行器注册中心地址[选填],为空则关闭自动注册 -->
<property name="adminAddresses" value="${xxl.job.admin.addresses}" /> <property name="adminAddresses" value="${xxl.job.admin.addresses}" />
<!-- 执行器日志路径[必填] --> <!-- 执行器日志路径[必填] -->
<property name="logPath" value="${xxl.job.executor.logpath}" /> <property name="logPath" value="${xxl.job.executor.logpath}" />
<!-- 访问令牌,非空则进行匹配校验[选填] --> <!-- 访问令牌,非空则进行匹配校验[选填] -->
<property name="accessToken" value="${xxl.job.accessToken}" /> <property name="accessToken" value="${xxl.job.accessToken}" />
</bean> </bean>
</beans> </beans>

@ -5,16 +5,16 @@
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" /> <param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout"> <layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-job-executor-example [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/> <param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-job-executor-sample-spring [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
</layout> </layout>
</appender> </appender>
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender"> <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="file" value="/data/applogs/xxl-job/xxl-job-executor-example.log"/> <param name="file" value="/data/applogs/xxl-job/xxl-job-executor-sample-spring.log"/>
<param name="append" value="true"/> <param name="append" value="true"/>
<param name="encoding" value="UTF-8"/> <param name="encoding" value="UTF-8"/>
<layout class="org.apache.log4j.PatternLayout"> <layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-job-executor-example [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/> <param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-job-executor-sample-spring [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
</layout> </layout>
</appender> </appender>

@ -2,7 +2,7 @@
xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
### xxl-job executor address ### xxl-job executor address
xxl.job.executor.appname=xxl-job-executor-example xxl.job.executor.appname=xxl-job-executor-sample
xxl.job.executor.ip= xxl.job.executor.ip=
xxl.job.executor.port=9999 xxl.job.executor.port=9999

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5"> id="WebApp_ID" version="2.5">
<context-param> <context-param>
<param-name>webAppRootKey</param-name> <param-name>webAppRootKey</param-name>
<param-value>xxl-job-client-demo</param-value> <param-value>xxl-job-executor-sample-spring</param-value>
</context-param> </context-param>
<context-param> <context-param>
<param-name>contextConfigLocation</param-name> <param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationcontext-*.xml</param-value> <param-value>classpath*:applicationcontext-*.xml</param-value>
</context-param> </context-param>
<listener> <listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener> </listener>
<listener> <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> </listener>
<welcome-file-list> <welcome-file-list>
<welcome-file>index.html</welcome-file> <welcome-file>index.html</welcome-file>
</welcome-file-list> </welcome-file-list>
</web-app> </web-app>

@ -5,10 +5,10 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>com.xuxueli</groupId> <groupId>com.xuxueli</groupId>
<artifactId>xxl-job</artifactId> <artifactId>xxl-job-executor-samples</artifactId>
<version>1.8.2-SNAPSHOT</version> <version>1.8.2-SNAPSHOT</version>
</parent> </parent>
<artifactId>xxl-job-executor-springboot-example</artifactId> <artifactId>xxl-job-executor-sample-springboot</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>

@ -9,7 +9,7 @@ logging.config=classpath:logback.xml
xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
### xxl-job executor address ### xxl-job executor address
xxl.job.executor.appname=xxl-job-executor-example xxl.job.executor.appname=xxl-job-executor-sample
xxl.job.executor.ip= xxl.job.executor.ip=
xxl.job.executor.port=9998 xxl.job.executor.port=9998

@ -2,7 +2,7 @@
<configuration debug="false" scan="true" scanPeriod="1 seconds"> <configuration debug="false" scan="true" scanPeriod="1 seconds">
<contextName>logback</contextName> <contextName>logback</contextName>
<property name="log.path" value="/data/applogs/xxl-job/xxl-job-executor-example.log"/> <property name="log.path" value="/data/applogs/xxl-job/xxl-job-executor-sample-springboot.log"/>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter" > <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter" >
Loading…
Cancel
Save