新增Nutz执行器Sample示例项目;

pull/6/head
xuxueli 7 years ago
parent 004b4971fa
commit 06c72af187

@ -386,9 +386,11 @@ XXL-JOB是一个轻量级分布式任务调度框架其核心设计目标是
任务逻辑以JobHandler的形式存在于“执行器”所在项目中开发流程如下 任务逻辑以JobHandler的形式存在于“执行器”所在项目中开发流程如下
#### 步骤一执行器项目中开发JobHandler #### 步骤一执行器项目中开发JobHandler
- 1、 新建一个继承com.xxl.job.core.handler.IJobHandler的Java类
- 2、 该类被Spring容器扫描为Bean实例如加“@Component”注解 - 1、继承"IJobHandler"“com.xxl.job.core.handler.IJobHandler”
- 3、 添加 “@JobHandler(value="自定义jobhandler名称")”注解注解的value值为自定义的JobHandler名称该名称对应的是调度中心新建任务的JobHandler属性的值。 - 2、注册到Spring容器添加“@Component”注解被Spring容器扫描为Bean实例
- 3、注册到执行器工厂添加“@JobHandler(value="自定义jobhandler名称")”注解注解value值对应的是调度中心新建任务的JobHandler属性的值。
- 4、执行日志需要通过 "XxlJobLogger.log" 打印执行日志;
可参考Sample示例执行器中的DemoJobHandler见下图 可参考Sample示例执行器中的DemoJobHandler见下图
![输入图片说明](https://static.oschina.net/uploads/img/201607/23232347_oLlM.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/23232347_oLlM.png "在这里输入图片标题")
@ -1073,32 +1075,33 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 10、任务日志文件路径时间戳格式化时SimpleDateFormat并发问题解决 - 10、任务日志文件路径时间戳格式化时SimpleDateFormat并发问题解决
### 6.20 版本 V1.9.0 特性[迭代中] ### 6.20 版本 V1.9.0 特性[迭代中]
- 1、新增任务运行模式 "GLUE模式(NodeJS) "支持NodeJS脚本任务 - 1、新增Nutz执行器Sample示例项目
- 2、脚本任务Shell、Python和Nodejs等支持获取分片参数 - 2、新增任务运行模式 "GLUE模式(NodeJS) "支持NodeJS脚本任务
- 3、失败重试完整支持调度中心调度失败且启用"失败重试"策略时,将会自动重试一次;执行器执行失败且回调失败重试状态(新增失败重试状态返回值)时,也将会自动重试一次; - 3、脚本任务Shell、Python和Nodejs等支持获取分片参数
- 4、失败告警策略扩展默认提供邮件失败告警可扩展短信等扩展代码位置为 "JobFailMonitorHelper.failAlarm" - 4、失败重试完整支持调度中心调度失败且启用"失败重试"策略时,将会自动重试一次;执行器执行失败且回调失败重试状态(新增失败重试状态返回值)时,也将会自动重试一次;
- 5、执行器端口支持自动生成(小于等于0时),避免端口定义冲突; - 5、失败告警策略扩展默认提供邮件失败告警可扩展短信等扩展代码位置为 "JobFailMonitorHelper.failAlarm"
- 6、调度报表优化支持时间区间筛选 - 6、执行器端口支持自动生成(小于等于0时),避免端口定义冲突;
- 7、Log组件支持输出异常栈信息底层实现优化 - 7、调度报表优化支持时间区间筛选
- 8、告警邮件样式优化调整为表格形式邮件组件调整为commons-email简化邮件操作 - 8、Log组件支持输出异常栈信息底层实现优化
- 9、项目依赖升级如spring、jackson等 - 9、告警邮件样式优化调整为表格形式邮件组件调整为commons-email简化邮件操作
- 10、任务日志记录发起调度的机器信息 - 10、项目依赖升级如spring、jackson等
- 11、交互优化如登陆注销 - 11、任务日志记录发起调度的机器信息
- 12、任务Cron长度扩展支持至128位支持负责类型Cron设置 - 12、交互优化如登陆注销
- 13、执行器地址录入交互优化地址长度扩展支持至512位支持大规模执行器集群配置 - 13、任务Cron长度扩展支持至128位支持负责类型Cron设置
- 14、任务参数“IJobHandler.execute”入参改为“String params”增强入参通用性。 - 14、执行器地址录入交互优化地址长度扩展支持至512位支持大规模执行器集群配置
- 15、JobHandler提供init/destroy方法支持在JobHandler初始化和销毁时进行附加操作 - 15、任务参数“IJobHandler.execute”入参改为“String params”增强入参通用性。
- 16、任务注解调整为 “@JobHandler”与任务抽象接口统一 - 16、JobHandler提供init/destroy方法支持在JobHandler初始化和销毁时进行附加操作
- 17、修复任务监控线程被耗时任务阻塞的问题 - 17、任务注解调整为 “@JobHandler”与任务抽象接口统一
- 18、修复任务监控线程无法监控任务触发和执行状态均未0的问题 - 18、修复任务监控线程被耗时任务阻塞的问题
- 19、执行器动态代理对象拦截非业务方法的执行 - 19、修复任务监控线程无法监控任务触发和执行状态均未0的问题
- 20、修复JobThread捕获Error错误不更新JobLog的问题 - 20、执行器动态代理对象拦截非业务方法的执行
- 21、修复任务列表界面左侧菜单合并时样式错乱问题 - 21、修复JobThread捕获Error错误不更新JobLog的问题
- 22、调度中心项目日志配置改为xml文件格式 - 22、修复任务列表界面左侧菜单合并时样式错乱问题
- 23、Log地址格式兼容支持非"/"结尾路径配置; - 23、调度中心项目日志配置改为xml文件格式
- 24、底层系统日志级别规范调整清理遗留代码 - 24、Log地址格式兼容支持非"/"结尾路径配置;
- 25、建表SQL优化支持同步创建制定编码的库和表 - 25、底层系统日志级别规范调整清理遗留代码
- 26、Nutz执行器Sample示例项目 - 26、建表SQL优化支持同步创建制定编码的库和表
### TODO LIST ### TODO LIST

@ -17,8 +17,9 @@ public class JFinalCoreConfig extends JFinalConfig {
private Logger logger = LoggerFactory.getLogger(JFinalCoreConfig.class); private Logger logger = LoggerFactory.getLogger(JFinalCoreConfig.class);
// ---------------------- xxl-job executor ---------------------- // ---------------------- xxl-job executor ----------------------
XxlJobExecutor xxlJobExecutor = null; private XxlJobExecutor xxlJobExecutor = null;
private void initXxlJobExecutor() { private void initXxlJobExecutor() {
// registry jobhandler // registry jobhandler
XxlJobExecutor.registJobHandler("demoJobHandler", new DemoJobHandler()); XxlJobExecutor.registJobHandler("demoJobHandler", new DemoJobHandler());
XxlJobExecutor.registJobHandler("shardingJobHandler", new ShardingJobHandler()); XxlJobExecutor.registJobHandler("shardingJobHandler", new ShardingJobHandler());

@ -7,4 +7,5 @@ public class IndexController extends Controller {
public void index(){ public void index(){
renderText("xxl job executor running."); renderText("xxl job executor running.");
} }
} }

@ -6,14 +6,13 @@ import com.xxl.job.core.log.XxlJobLogger;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
* HandlerDemoBean * HandlerBean
* *
* *
* 1 IJobHandler * 1"IJobHandler"com.xxl.job.core.handler.IJobHandler
* 2 "XxlJobLogger.log" * 2 "JFinalCoreConfig.initXxlJobExecutor" keyJobHandler
* 3"JFinalCoreConfig" Jobhandler * 3 "XxlJobLogger.log"
* *
* @author xuxueli 2015-12-19 19:43:36 * @author xuxueli 2015-12-19 19:43:36
*/ */

@ -4,7 +4,7 @@ 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-sample xxl.job.executor.appname=xxl-job-executor-sample
xxl.job.executor.ip= xxl.job.executor.ip=
xxl.job.executor.port=9997 xxl.job.executor.port=9996
### xxl-job log path ### xxl-job log path
xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler

@ -3,6 +3,7 @@
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="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" 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">
<display-name>xxl-job-executor-sample-jfinal</display-name> <display-name>xxl-job-executor-sample-jfinal</display-name>
<context-param> <context-param>
<param-name>webAppRootKey</param-name> <param-name>webAppRootKey</param-name>
@ -23,4 +24,9 @@
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</filter-mapping> </filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app> </web-app>

@ -1,26 +1,23 @@
package com.xuxueli.executor.sample.nutz; package com.xuxueli.executor.sample.nutz;
import org.nutz.mvc.annotation.Encoding; import com.xuxueli.executor.sample.nutz.config.NutzSetup;
import org.nutz.mvc.annotation.Fail; import org.nutz.mvc.annotation.*;
import org.nutz.mvc.annotation.IocBy;
import org.nutz.mvc.annotation.Localization;
import org.nutz.mvc.annotation.Modules;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.SetupBy;
import org.nutz.mvc.ioc.provider.ComboIocProvider; import org.nutz.mvc.ioc.provider.ComboIocProvider;
/** /**
* * nutz module
* @author
* *
* @author xuxueli 2017-12-25 17:58:43
*/ */
@IocBy(type=ComboIocProvider.class,args={"*org.nutz.ioc.loader.json.JsonLoader","ioc/", @IocBy(type = ComboIocProvider.class,
"*org.nutz.ioc.loader.annotation.AnnotationIocLoader","com.xuxueli"}) args = {"*org.nutz.ioc.loader.annotation.AnnotationIocLoader",
@Encoding(input="utf-8",output="utf-8") "com.xuxueli.executor.sample.nutz"})
@Modules(scanPackage=true) @Encoding(input = "utf-8", output = "utf-8")
@Modules(scanPackage = true)
@Localization("msg") @Localization("msg")
@Ok("json") @Ok("json")
@Fail("json") @Fail("json")
@SetupBy(MainSetup.class) @SetupBy(NutzSetup.class)
public class MainModule { public class MainModule {
} }

@ -1,33 +1,41 @@
package com.xuxueli.executor.sample.nutz; package com.xuxueli.executor.sample.nutz.config;
import org.nutz.ioc.IocException; import com.xxl.job.core.executor.XxlJobExecutor;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import org.nutz.ioc.impl.PropertiesProxy; import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.NutConfig; import org.nutz.mvc.NutConfig;
import org.nutz.mvc.Setup; import org.nutz.mvc.Setup;
import org.slf4j.Logger;
import com.xxl.job.core.executor.XxlJobExecutor; import org.slf4j.LoggerFactory;
import com.xxl.job.core.handler.IJobHandler;
/** /**
* * nutz setup
* @author
* *
* @author xuxueli 2017-12-25 17:58:43
*/ */
public class MainSetup implements Setup { public class NutzSetup implements Setup {
public static final Log log = Logs.get(); private Logger logger = LoggerFactory.getLogger(NutzSetup.class);
XxlJobExecutor xxlJobExecutor = null; //public static final Log logger = Logs.get();
private XxlJobExecutor xxlJobExecutor = null;
@Override @Override
public void init(NutConfig cfg) { public void init(NutConfig cfg) {
// 通用注册IJobHandler
String[] names = cfg.getIoc().getNamesByType(IJobHandler.class); // regist JobHandler
for (String name : names) { String[] beanNames = cfg.getIoc().getNamesByType(IJobHandler.class);
XxlJobExecutor.registJobHandler(name, cfg.getIoc().get(IJobHandler.class, name)); if (beanNames==null || beanNames.length==0) {
return;
}
for (String beanName : beanNames) {
IJobHandler jobHandler = cfg.getIoc().get(IJobHandler.class, beanName);
String name = jobHandler.getClass().getAnnotation(JobHandler.class).value();
XxlJobExecutor.registJobHandler(name, jobHandler);
} }
// load executor prop // load executor prop
PropertiesProxy xxlJobProp = cfg.getIoc().get(PropertiesProxy.class, "conf"); PropertiesProxy xxlJobProp = new PropertiesProxy("xxl-job-executor.properties");
// init executor // init executor
xxlJobExecutor = new XxlJobExecutor(); xxlJobExecutor = new XxlJobExecutor();
@ -42,7 +50,7 @@ public class MainSetup implements Setup {
try { try {
xxlJobExecutor.start(); xxlJobExecutor.start();
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
} }
@ -52,4 +60,5 @@ public class MainSetup implements Setup {
xxlJobExecutor.destroy(); xxlJobExecutor.destroy();
} }
} }
} }

@ -1,36 +1,38 @@
package com.xuxueli.executor.sample.nutz.jobhandler; package com.xuxueli.executor.sample.nutz.jobhandler;
import java.util.concurrent.TimeUnit;
import org.nutz.ioc.loader.annotation.IocBean;
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.JobHandler;
import com.xxl.job.core.log.XxlJobLogger; import com.xxl.job.core.log.XxlJobLogger;
import org.nutz.ioc.loader.annotation.IocBean;
import java.util.concurrent.TimeUnit;
/** /**
* HandlerDemoBean * HandlerBean
* *
* *
* 1 IJobHandler * 1"IJobHandler"com.xxl.job.core.handler.IJobHandler
* 2 "XxlJobLogger.log" * 2Nutz@IocBeanNutzBean
* 3 "JFinalCoreConfig" Jobhandler * 3@JobHandler(value="自定义jobhandler名称")valueJobHandler
* 4 "XxlJobLogger.log"
* *
* @author xuxueli 2015-12-19 19:43:36 * @author xuxueli 2015-12-19 19:43:36
*/ */
@JobHandler(value="demoJobHandler")
@IocBean @IocBean
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 param) 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 SUCCESS;
} }
} }

@ -1,5 +1,6 @@
package com.xuxueli.executor.sample.nutz.jobhandler; package com.xuxueli.executor.sample.nutz.jobhandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
@ -7,17 +8,17 @@ import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.log.XxlJobLogger; import com.xxl.job.core.log.XxlJobLogger;
import com.xxl.job.core.util.ShardingUtil; import com.xxl.job.core.util.ShardingUtil;
/** /**
* 广 * 广
* *
* @author xuxueli 2017-07-25 20:56:50 * @author xuxueli 2017-07-25 20:56:50
*/ */
@JobHandler(value="shardingJobHandler")
@IocBean @IocBean
public class ShardingJobHandler extends IJobHandler { public class ShardingJobHandler extends IJobHandler {
@Override @Override
public ReturnT<String> execute(String... params) throws Exception { public ReturnT<String> execute(String param) throws Exception {
// 分片参数 // 分片参数
ShardingUtil.ShardingVO shardingVO = ShardingUtil.getShardingVo(); ShardingUtil.ShardingVO shardingVO = ShardingUtil.getShardingVo();
@ -32,7 +33,7 @@ public class ShardingJobHandler extends IJobHandler {
} }
} }
return ReturnT.SUCCESS; return SUCCESS;
} }
} }

@ -3,16 +3,14 @@ package com.xuxueli.executor.sample.nutz.module;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
/**
*
* @author
*
*/
@IocBean @IocBean
public class IndexModule { public class IndexModule {
@At @At("/")
@Ok("jsp:index") @Ok("json")
public void index() { public String index() {
return "xxl job executor running.";
} }
} }

@ -1,38 +0,0 @@
var ioc = {
conf : {
type : "org.nutz.ioc.impl.PropertiesProxy",
fields : {
paths : [ "custom/" ]
}
},
/**
* job
*/
/*xxlJobExecutor : {
type : "com.xxl.job.core.executor.XxlJobExecutor",
events : {
create : "start",
depose : "destroy"
},
fields : {
ip : {
java : "$conf.get('xxl.job.executor.ip')"
},
port : {
java : "$conf.get('xxl.job.executor.port')"
},
appName : {
java : "$conf.get('xxl.job.executor.appname')"
},
adminAddresses : {
java : "$conf.get('xxl.job.admin.addresses')"
},
logPath : {
java : "$conf.get('xxl.job.executor.logpath')"
},
accessToken : {
java : "$conf.get('xxl.job.accessToken')"
}
}
}*/
};

@ -2,19 +2,19 @@
<!DOCTYPE log4j:configuration PUBLIC "-//log4j/log4j Configuration//EN" "log4j.dtd"> <!DOCTYPE log4j:configuration PUBLIC "-//log4j/log4j Configuration//EN" "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" threshold="null" debug="null"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" threshold="null" debug="null">
<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} spider-executor [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/> <param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-job-executor-sample-nutz [%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/spider-executor.log"/> <param name="file" value="/data/applogs/xxl-job/xxl-job-executor-sample-nutz.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} spider-executor [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/> <param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-job-executor-sample-nutz [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
</layout> </layout>
</appender> </appender>

@ -4,10 +4,10 @@ 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-sample xxl.job.executor.appname=xxl-job-executor-sample
xxl.job.executor.ip= xxl.job.executor.ip=
xxl.job.executor.port=1024 xxl.job.executor.port=9997
### xxl-job log path ### xxl-job log path
xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler/ xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler
### xxl-job, access token ### xxl-job, access token
xxl.job.accessToken= xxl.job.accessToken=

@ -1,12 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>nutz 执行器启动成功</title>
</head>
<body>
nutz 执行器启动成功!
</body>
</html>

@ -3,9 +3,16 @@
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="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" 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">
<display-name>xxl-job-executor-sample-nutz</display-name> <display-name>xxl-job-executor-sample-nutz</display-name>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>xxl-job-executor-sample-nutz</param-value>
</context-param>
<!-- nutz -->
<filter> <filter>
<filter-name>xxl-job-executor-sample-nutz</filter-name> <filter-name>nutz</filter-name>
<filter-class>org.nutz.mvc.NutFilter</filter-class> <filter-class>org.nutz.mvc.NutFilter</filter-class>
<init-param> <init-param>
<param-name>modules</param-name> <param-name>modules</param-name>
@ -13,10 +20,13 @@
</init-param> </init-param>
</filter> </filter>
<filter-mapping> <filter-mapping>
<filter-name>xxl-job-executor-sample-nutz</filter-name> <filter-name>nutz</filter-name>
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</filter-mapping> </filter-mapping>
<welcome-file-list> <welcome-file-list>
<welcome-file>index</welcome-file> <welcome-file>index.html</welcome-file>
</welcome-file-list> </welcome-file-list>
</web-app> </web-app>

@ -10,12 +10,12 @@ import java.util.concurrent.TimeUnit;
/** /**
* HandlerDemoBean * HandlerBean
* *
* *
* 1com.xxl.job.core.handler.IJobHandlerJava * 1"IJobHandler"com.xxl.job.core.handler.IJobHandler
* 2SpringBean@Component * 2Spring@ComponentSpringBean
* 3 @JobHandler(value="自定义jobhandler名称")valueJobHandlerJobHandler * 3@JobHandler(value="自定义jobhandler名称")valueJobHandler
* 4 "XxlJobLogger.log" * 4 "XxlJobLogger.log"
* *
* @author xuxueli 2015-12-19 19:43:36 * @author xuxueli 2015-12-19 19:43:36

@ -3,12 +3,14 @@
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">
<display-name>xxl-job-executor-sample-spring</display-name> <display-name>xxl-job-executor-sample-spring</display-name>
<context-param> <context-param>
<param-name>webAppRootKey</param-name> <param-name>webAppRootKey</param-name>
<param-value>xxl-job-executor-sample-spring</param-value> <param-value>xxl-job-executor-sample-spring</param-value>
</context-param> </context-param>
<!-- spring -->
<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>
@ -20,7 +22,8 @@
<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>

@ -10,12 +10,12 @@ import java.util.concurrent.TimeUnit;
/** /**
* HandlerDemoBean * HandlerBean
* *
* *
* 1com.xxl.job.core.handler.IJobHandlerJava * 1"IJobHandler"com.xxl.job.core.handler.IJobHandler
* 2SpringBean@Component * 2Spring@ComponentSpringBean
* 3 @JobHandler(value="自定义jobhandler名称")valueJobHandlerJobHandler * 3@JobHandler(value="自定义jobhandler名称")valueJobHandler
* 4 "XxlJobLogger.log" * 4 "XxlJobLogger.log"
* *
* @author xuxueli 2015-12-19 19:43:36 * @author xuxueli 2015-12-19 19:43:36

@ -11,7 +11,7 @@ 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-sample xxl.job.executor.appname=xxl-job-executor-sample
xxl.job.executor.ip= xxl.job.executor.ip=
xxl.job.executor.port=-1 xxl.job.executor.port=9998
### xxl-job log path ### xxl-job log path
xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler

Loading…
Cancel
Save