Commit 2e12b525 by wengbinbin

文档修改

parent b9f08361
官方文档:https://github.com/xuxueli/xxl-job ### 官方文档:https://github.com/xuxueli/xxl-job
如何使用 ### 如何接入使用
1.项目中引入jar包 #### 1.项目中引入jar包
<dependency> ```
<groupId>com.ydl</groupId> <dependency>
<artifactId>xxl-job-spring-boot-starter</artifactId> <groupId>com.ydl</groupId>
<version>0.0.1-SNAPSHOT</version> <artifactId>xxl-job-spring-boot-starter</artifactId>
</dependency> <version>0.0.1-SNAPSHOT</version>
</dependency>
2.配置application文件 ```
#### 2.配置application文件
```
### 调度中心地址,集群可多地址 ### 调度中心地址,集群可多地址
xxl.job.admin-addresses=http://121.41.92.140:8093/xxl-job-admin,http://121.41.92.140:8094/xxl-job-admin xxl.job.admin-addresses=http://121.41.92.140:8093/xxl-job-admin,http://121.41.92.140:8094/xxl-job-admin
...@@ -23,30 +26,39 @@ ...@@ -23,30 +26,39 @@
### 类似dubbo的端口,由运维为项目分配 ### 类似dubbo的端口,由运维为项目分配
xxl.job.executor-port=9999 xxl.job.executor-port=9999
```
3.项目中定时任务改写 #### 3.项目中定时任务改写
```
继承IJobHandler接口,execute方法中实现定时逻辑,注解JobHandler中定义value值 继承IJobHandler接口,execute方法中实现定时逻辑,注解JobHandler中定义value值
示例: 示例:
@JobHandler(value = "dispatchDuringTimeHandler") @JobHandler(value = "dispatchDuringTimeHandler")
@Component @Component
@Slf4j @Slf4j
public class DispatchDuringTime extends IJobHandler { public class DispatchDuringTime extends IJobHandler {
@Resource @Resource
private CrmDispatchDataBiz crmDispatchDataBiz; private CrmDispatchDataBiz crmDispatchDataBiz;
@Override
public ReturnT<String> execute(String param) throws Exception {
crmDispatchDataBiz.currentData();
return SUCCESS;
}
}
4.调度中心中添加配置 @Override
public ReturnT<String> execute(String param) throws Exception {
crmDispatchDataBiz.currentData();
return SUCCESS;
}
}
```
#### 4.调度中心中添加配置
每个项目需添加执行管理器 每个项目需添加执行管理器(每个项目设置一次)
为每个JobHandler设置定时任务 为每个JobHandler设置定时任务代替
@Scheduled(cron = "0 0 3 * * ?")
#### 5.调度中心配置地址(测试)
http://121.41.92.140:8093/xxl-job-admin/
admin
123456
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment