Please answer some questions before submitting your issue. Thanks!
com.xuxueli xxl-job-core 2.4.0
执行器启动就注册到admin
需要再admin录入APPNAME
mxg2im7a1#
这个从设计上来说手动注册估计更方便管理,配置角色什么的,不是单纯的自动注册
qzlgjiam2#
邮件已经收到,谢谢!
g52tjvyc3#
如果要做的话,可以在项目启动的时候在代码里手动调用增加执行器的接口完成,以避免每次业务项目上线的时候上线人员去调度中心人工增加。
dced5bon4#
主要也是确认下是不是已经有了这个东西,我没找到
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; }
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); }
@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; }
pxq42qpu6#
初始化都没完成,也就没有向admin注册?这里就不执行了呢?打断点也进不去?
lvjbypge7#
7条答案
按热度按时间mxg2im7a1#
这个从设计上来说手动注册估计更方便管理,配置角色什么的,不是单纯的自动注册
qzlgjiam2#
邮件已经收到,谢谢!
g52tjvyc3#
如果要做的话,可以在项目启动的时候在代码里手动调用增加执行器的接口完成,以避免每次业务项目上线的时候上线人员去调度中心人工增加。
dced5bon4#
如果要做的话,可以在项目启动的时候在代码里手动调用增加执行器的接口完成,以避免每次业务项目上线的时候上线人员去调度中心人工增加。
主要也是确认下是不是已经有了这个东西,我没找到
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; }
pxq42qpu6#
初始化都没完成,也就没有向admin注册?
这里就不执行了呢?打断点也进不去?
lvjbypge7#
邮件已经收到,谢谢!