xxl-job 执行器自动注册必须要在调度中心输入APPNAME才能实现自动注册吗?是不是可以执行器启动就注册

falq053o  于 2个月前  发布在  其他
关注(0)|答案(7)|浏览(44)

Please answer some questions before submitting your issue. Thanks!

Which version of XXL-JOB do you using?

com.xuxueli xxl-job-core 2.4.0

Expected behavior

执行器启动就注册到admin

Actual behavior

需要再admin录入APPNAME

Steps to reproduce the behavior

Other information

mxg2im7a

mxg2im7a1#

这个从设计上来说手动注册估计更方便管理,配置角色什么的,不是单纯的自动注册

qzlgjiam

qzlgjiam2#

邮件已经收到,谢谢!

g52tjvyc

g52tjvyc3#

如果要做的话,可以在项目启动的时候在代码里手动调用增加执行器的接口完成,以避免每次业务项目上线的时候上线人员去调度中心人工增加。

dced5bon

dced5bon4#

如果要做的话,可以在项目启动的时候在代码里手动调用增加执行器的接口完成,以避免每次业务项目上线的时候上线人员去调度中心人工增加。

主要也是确认下是不是已经有了这个东西,我没找到

mpbci0fu

mpbci0fu5#

这段代码在注册
private void initEmbedServer(String address, String ip, int port, String appname, String accessToken) throws Exception { // fill ip port port = port>0?port: NetUtil.findAvailablePort(9999); ip = (ip!=null&&ip.trim().length()>0)?ip: IpUtil.getIp(); // generate address if (address==null || address.trim().length()==0) { String ip_port_address = IpUtil.getIpPort(ip, port); // registry-address:default use address to registry , otherwise use ip:port if address is null address = "http://{ip_port}/".replace("{ip_port}", ip_port_address); } // accessToken if (accessToken==null || accessToken.trim().length()==0) { logger.warn(">>>>>>>>>>> xxl-job accessToken is empty. To ensure system security, please set the accessToken."); } // start embedServer = new EmbedServer(); embedServer.start(address, port, appname, accessToken); }
如果是Spring项目,简单的做法是将XxlJobSpringExecutor注册为Bean,afterSingletonsInstantiated()方法被调用,最终会调用到上述注册执行器方法,例如
@Bean public XxlJobSpringExecutor xxlJobExecutor() { logger.info(">>>>>>>>>>> xxl-job config init."); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); xxlJobSpringExecutor.setAdminAddresses(adminAddresses); xxlJobSpringExecutor.setAppname(appName); xxlJobSpringExecutor.setPort(port); xxlJobSpringExecutor.setAccessToken(accessToken); xxlJobSpringExecutor.setLogPath(logPath); xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); return xxlJobSpringExecutor; }

pxq42qpu

pxq42qpu6#

初始化都没完成,也就没有向admin注册?
这里就不执行了呢?打断点也进不去?

lvjbypge

lvjbypge7#

邮件已经收到,谢谢!

相关问题