恢复
xxl-job
This commit is contained in:
+24
-24
@@ -53,8 +53,8 @@ public class StockInOrderApi extends BaseController {
|
||||
private StockInOrderAssembler stockInOrderAssembler;
|
||||
@Resource
|
||||
private StockOutOrderAssembler stockOutOrderAssembler;
|
||||
@Autowired
|
||||
private XxlJobServiceFeign xxlJobServiceFeign;
|
||||
// @Autowired
|
||||
// private XxlJobServiceFeign xxlJobServiceFeign;
|
||||
|
||||
/**
|
||||
* 分页查询入库单列表
|
||||
@@ -353,32 +353,32 @@ public class StockInOrderApi extends BaseController {
|
||||
return stockInOrderApplicationService.batchSignature(dto);
|
||||
}
|
||||
|
||||
@GetMapping("/xxlopenfeign")
|
||||
public AjaxResult xxlopenfeign(@RequestParam String param) {
|
||||
R<Map<String, Object>> mapR = xxlJobServiceFeign.openFeignTest(param);
|
||||
return AjaxResult.success(mapR);
|
||||
}
|
||||
// @GetMapping("/xxlopenfeign")
|
||||
// public AjaxResult xxlopenfeign(@RequestParam String param) {
|
||||
// R<Map<String, Object>> mapR = xxlJobServiceFeign.openFeignTest(param);
|
||||
// return AjaxResult.success(mapR);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 1. 简单任务示例(Bean模式)
|
||||
* 这里的 demoJobHandler 必须和调度中心配置一致
|
||||
*/
|
||||
@XxlJob("demoJobHandler")
|
||||
public void demoJobHandler() {
|
||||
// 获取任务参数
|
||||
String param = XxlJobHelper.getJobParam();
|
||||
logger.info("XXL-JOB 开始执行,参数:{}", param);
|
||||
|
||||
try {
|
||||
// ========== 你的业务逻辑 ==========
|
||||
logger.info("执行若依微服务定时任务...");
|
||||
|
||||
// 设置任务执行结果
|
||||
XxlJobHelper.handleSuccess("执行成功");
|
||||
} catch (Exception e) {
|
||||
logger.error("XXL-JOB 执行失败", e);
|
||||
XxlJobHelper.handleFail("执行失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
// @XxlJob("demoJobHandler")
|
||||
// public void demoJobHandler() {
|
||||
// // 获取任务参数
|
||||
// String param = XxlJobHelper.getJobParam();
|
||||
// logger.info("XXL-JOB 开始执行,参数:{}", param);
|
||||
//
|
||||
// try {
|
||||
// // ========== 你的业务逻辑 ==========
|
||||
// logger.info("执行若依微服务定时任务...");
|
||||
//
|
||||
// // 设置任务执行结果
|
||||
// XxlJobHelper.handleSuccess("执行成功");
|
||||
// } catch (Exception e) {
|
||||
// logger.error("XXL-JOB 执行失败", e);
|
||||
// XxlJobHelper.handleFail("执行失败:" + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -9,46 +9,46 @@ import org.springframework.context.annotation.Configuration;
|
||||
/**
|
||||
* XXL-JOB 配置类
|
||||
*/
|
||||
@Configuration
|
||||
//@Configuration
|
||||
public class XxlJobConfig {
|
||||
private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
|
||||
|
||||
@Value("${xxl.job.admin.addresses}")
|
||||
private String adminAddresses;
|
||||
|
||||
@Value("${xxl.job.accessToken}")
|
||||
private String accessToken;
|
||||
|
||||
@Value("${xxl.job.executor.appname}")
|
||||
private String appname;
|
||||
|
||||
@Value("${xxl.job.executor.address}")
|
||||
private String address;
|
||||
|
||||
@Value("${xxl.job.executor.ip}")
|
||||
private String ip;
|
||||
|
||||
@Value("${xxl.job.executor.port}")
|
||||
private int port;
|
||||
|
||||
@Value("${xxl.job.executor.logpath}")
|
||||
private String logPath;
|
||||
|
||||
@Value("${xxl.job.executor.logretentiondays}")
|
||||
private int logRetentionDays;
|
||||
|
||||
@Bean
|
||||
public XxlJobSpringExecutor xxlJobExecutor() {
|
||||
logger.info(">>>>>>>>>>> xxl-job config init.");
|
||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
|
||||
xxlJobSpringExecutor.setAppname(appname);
|
||||
xxlJobSpringExecutor.setAddress(address);
|
||||
xxlJobSpringExecutor.setIp(ip);
|
||||
xxlJobSpringExecutor.setPort(port);
|
||||
xxlJobSpringExecutor.setAccessToken(accessToken);
|
||||
xxlJobSpringExecutor.setLogPath(logPath);
|
||||
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
|
||||
return xxlJobSpringExecutor;
|
||||
}
|
||||
// private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
|
||||
//
|
||||
// @Value("${xxl.job.admin.addresses}")
|
||||
// private String adminAddresses;
|
||||
//
|
||||
// @Value("${xxl.job.accessToken}")
|
||||
// private String accessToken;
|
||||
//
|
||||
// @Value("${xxl.job.executor.appname}")
|
||||
// private String appname;
|
||||
//
|
||||
// @Value("${xxl.job.executor.address}")
|
||||
// private String address;
|
||||
//
|
||||
// @Value("${xxl.job.executor.ip}")
|
||||
// private String ip;
|
||||
//
|
||||
// @Value("${xxl.job.executor.port}")
|
||||
// private int port;
|
||||
//
|
||||
// @Value("${xxl.job.executor.logpath}")
|
||||
// private String logPath;
|
||||
//
|
||||
// @Value("${xxl.job.executor.logretentiondays}")
|
||||
// private int logRetentionDays;
|
||||
//
|
||||
// @Bean
|
||||
// public XxlJobSpringExecutor xxlJobExecutor() {
|
||||
// logger.info(">>>>>>>>>>> xxl-job config init.");
|
||||
// XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||
// xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
|
||||
// xxlJobSpringExecutor.setAppname(appname);
|
||||
// xxlJobSpringExecutor.setAddress(address);
|
||||
// xxlJobSpringExecutor.setIp(ip);
|
||||
// xxlJobSpringExecutor.setPort(port);
|
||||
// xxlJobSpringExecutor.setAccessToken(accessToken);
|
||||
// xxlJobSpringExecutor.setLogPath(logPath);
|
||||
// xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
|
||||
// return xxlJobSpringExecutor;
|
||||
// }
|
||||
}
|
||||
@@ -36,24 +36,24 @@ spring:
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# XXL-JOB 配置
|
||||
xxl:
|
||||
job:
|
||||
# 调度中心地址(填你部署的地址)
|
||||
admin:
|
||||
addresses: http://192.168.1.6:8020/xxl-job-admin
|
||||
# 执行器配置
|
||||
executor:
|
||||
# 执行器名称(自定义,后面调度中心要用到)
|
||||
appname: wms-service-executor
|
||||
# 执行器注册地址,默认0表示自动获取
|
||||
address:
|
||||
# 执行器IP,默认空自动获取
|
||||
ip:
|
||||
# 执行器端口号(每个微服务不能重复,建议9997/9998/9999)
|
||||
port: 9997
|
||||
# 执行器日志存放路径
|
||||
logpath: /data/applogs/xxl-job/jobhandler
|
||||
# 日志保留天数
|
||||
logretentiondays: 30
|
||||
# 调度中心通讯令牌(默认空,安全可设置)
|
||||
accessToken: default_token
|
||||
#xxl:
|
||||
# job:
|
||||
# # 调度中心地址(填你部署的地址)
|
||||
# admin:
|
||||
# addresses: http://192.168.1.6:8020/xxl-job-admin
|
||||
# # 执行器配置
|
||||
# executor:
|
||||
# # 执行器名称(自定义,后面调度中心要用到)
|
||||
# appname: wms-service-executor
|
||||
# # 执行器注册地址,默认0表示自动获取
|
||||
# address:
|
||||
# # 执行器IP,默认空自动获取
|
||||
# ip:
|
||||
# # 执行器端口号(每个微服务不能重复,建议9997/9998/9999)
|
||||
# port: 9997
|
||||
# # 执行器日志存放路径
|
||||
# logpath: /data/applogs/xxl-job/jobhandler
|
||||
# # 日志保留天数
|
||||
# logretentiondays: 30
|
||||
# # 调度中心通讯令牌(默认空,安全可设置)
|
||||
# accessToken: default_token
|
||||
Reference in New Issue
Block a user