🎨 同步xxl-job2.2.0新增的address配置,解决容器部署时自动注册的ip问题
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.hccake.ballcat.common.job;
|
||||
|
||||
import com.hccake.ballcat.common.job.properties.XxlExecutorProperties;
|
||||
import com.hccake.ballcat.common.job.properties.XxlJobProperties;
|
||||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -21,12 +22,14 @@ public class XxlJobAutoConfiguration {
|
||||
log.info(">>>>>>>>>>> xxl-job config init.");
|
||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||
xxlJobSpringExecutor.setAdminAddresses(xxlJobProperties.getAdmin().getAddresses());
|
||||
xxlJobSpringExecutor.setAppname(xxlJobProperties.getExecutor().getAppname());
|
||||
xxlJobSpringExecutor.setIp(xxlJobProperties.getExecutor().getIp());
|
||||
xxlJobSpringExecutor.setPort(xxlJobProperties.getExecutor().getPort());
|
||||
xxlJobSpringExecutor.setAccessToken(xxlJobProperties.getExecutor().getAccessToken());
|
||||
xxlJobSpringExecutor.setLogPath(xxlJobProperties.getExecutor().getLogPath());
|
||||
xxlJobSpringExecutor.setLogRetentionDays(xxlJobProperties.getExecutor().getLogRetentionDays());
|
||||
XxlExecutorProperties executorProperties = xxlJobProperties.getExecutor();
|
||||
xxlJobSpringExecutor.setAppname(executorProperties.getAppname());
|
||||
xxlJobSpringExecutor.setIp(executorProperties.getIp());
|
||||
xxlJobSpringExecutor.setPort(executorProperties.getPort());
|
||||
xxlJobSpringExecutor.setAccessToken(executorProperties.getAccessToken());
|
||||
xxlJobSpringExecutor.setLogPath(executorProperties.getLogPath());
|
||||
xxlJobSpringExecutor.setLogRetentionDays(executorProperties.getLogRetentionDays());
|
||||
xxlJobSpringExecutor.setAddress(executorProperties.getAddress());
|
||||
return xxlJobSpringExecutor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@ public class XxlExecutorProperties {
|
||||
*/
|
||||
private String appname = "xxl-job-executor";
|
||||
|
||||
/**
|
||||
* 优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址
|
||||
* 从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP
|
||||
* ,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务"
|
||||
|
||||
@@ -2,14 +2,12 @@ package com.hccake.ballcat.common.job.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2019-09-18
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "xxl.job")
|
||||
public class XxlJobProperties {
|
||||
private XxlAdminProperties admin = new XxlAdminProperties();
|
||||
|
||||
Reference in New Issue
Block a user