执行器注册逻辑优化:新增配置项 ”注册地址 / xxl.job.executor.address“,优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持docker执行器动态ip和动态映射端口问题。

pull/16/head
xuxueli 5 years ago
parent 239200e52c
commit d13130824d

@ -1729,12 +1729,13 @@ url: http://www.xxx.com
method: get 或 post
data: post-data
```
- 15、[迭代中]自定义失败重试时间间隔;
- 16、[迭代中]任务复制功能;点击复制是弹出新建任务弹框,并初始化被复制任务信息;
- 17、[迭代中]新增执行器描述、任务描述属性;
- 18、[迭代中]任务执行一次的时候指定IP
- 19、[迭代中]任务日志支持单个清理和状态转移,方便触发子任务;
- 20、[迭代中]任务结果丢失处理:针对长期处于运行中的任务(设置过期时间时,运行超过"过期时间+1min";未设置超时时间时,运行超过"30min"),主动检测该执行器是否在线,如果不在线主动标记失败;
- 15、执行器注册逻辑优化新增配置项 ”注册地址 / xxl.job.executor.address“优先使用该配置作为注册地址为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持docker执行器动态ip和动态映射端口问题。
- 16、[迭代中]自定义失败重试时间间隔;
- 17、[迭代中]任务复制功能;点击复制是弹出新建任务弹框,并初始化被复制任务信息;
- 18、[迭代中]新增执行器描述、任务描述属性;
- 19、[迭代中]任务执行一次的时候指定IP
- 20、[迭代中]任务日志支持单个清理和状态转移,方便触发子任务;
- 21、[迭代中]任务结果丢失处理:针对长期处于运行中的任务(设置过期时间时,运行超过"过期时间+1min";未设置超时时间时,运行超过"30min"),主动检测该执行器是否在线,如果不在线主动标记失败;
### TODO LIST

@ -32,28 +32,32 @@ public class XxlJobExecutor {
// ---------------------- param ----------------------
private String adminAddresses;
private String accessToken;
private String appName;
private String address;
private String ip;
private int port;
private String accessToken;
private String logPath;
private int logRetentionDays;
public void setAdminAddresses(String adminAddresses) {
this.adminAddresses = adminAddresses;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public void setAppName(String appName) {
this.appName = appName;
}
public void setAddress(String address) {
this.address = address;
}
public void setIp(String ip) {
this.ip = ip;
}
public void setPort(int port) {
this.port = port;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public void setLogPath(String logPath) {
this.logPath = logPath;
}
@ -81,7 +85,7 @@ public class XxlJobExecutor {
// init executor-server
port = port>0?port: NetUtil.findAvailablePort(9999);
ip = (ip!=null&&ip.trim().length()>0)?ip: IpUtil.getIp();
initRpcProvider(ip, port, appName, accessToken);
initRpcProvider(address, ip, port, appName, accessToken);
}
public void destroy(){
// destory executor-server
@ -143,10 +147,12 @@ public class XxlJobExecutor {
// ---------------------- executor-server (rpc provider) ----------------------
private XxlRpcProviderFactory xxlRpcProviderFactory = null;
private void initRpcProvider(String ip, int port, String appName, String accessToken) throws Exception {
private void initRpcProvider(String address, String ip, int port, String appName, String accessToken) throws Exception {
// init, provider factory
String address = IpUtil.getIpPort(ip, port);
if (address==null || address.trim().length()==0) {
address = IpUtil.getIpPort(ip, port); // registry-addressdefault use address to registry , otherwise use ip:port if address is null
}
Map<String, String> serviceRegistryParam = new HashMap<String, String>();
serviceRegistryParam.put("appName", appName);
serviceRegistryParam.put("address", address);

@ -19,18 +19,21 @@ public class XxlJobConfig {
@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.accessToken}")
private String accessToken;
@Value("${xxl.job.executor.logpath}")
private String logPath;
@ -44,6 +47,7 @@ public class XxlJobConfig {
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppName(appName);
xxlJobSpringExecutor.setAddress(address);
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAccessToken(accessToken);

Loading…
Cancel
Save