glue java是什么,让我们一起了解一下?
GLUE是一种新型的分布式平台,它用纯Java语言编写,能提供类似于CORBA和RMI的分布对象技术。它不仅适用于企业级的分布式计算,也适用于并行科学计算。
例如我们让XXL-Job使用GLUE(Java)调度REST接口该如何操作?
首先xxl-job-admin你应该先跑起来,然后新建一个SpringBoot项目里面加上xxl-job的依赖,xxl-job的config等配置信息。
com.xuxueli xxl-job-core 2.1.0
在application.properties中追加以下内容。
xxl.job.admin.address = http://127.0.0.1:8080/xxl-job-admin xxl.job.executor.appname = rone-spark xxl.job.executor.ip = 127.0.0.1 xxl.job.executor.port = 9999 xxl.job.executor.logpath = /data/applogs/xxl-job/jobhandler xxl.job.executor.logretentiondays = -1
然后在新建一个xxl-job-config类。
package com.rone.demo.XXLJob; import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class XxlJobConfig { private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class); @Value("${xxl.job.admin.address}") private String adminAddresses ;//="http://localhost:8080/xxl-job-admin" ; @Value("${xxl.job.executor.appname}") private String appName ;//="RoneDemo"; @Value("${xxl.job.executor.ip}") private String ip ;//= "127.0.0.1"; @Value("${xxl.job.executor.port}") private int port ;//= 9999; /* @Value("${xxl.job.accessToken}")*/ private String accessToken; @Value("${xxl.job.executor.logpath}") private String logPath ; //@Value("${xxl.job.executor.logretentiondays}") private int logRetentionDays = -1; @Bean(initMethod = "start", destroyMethod = "destroy") public XxlJobSpringExecutor xxlJobExecutor() { logger.info(">>>>>>>>>>> xxl-job config init."); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); xxlJobSpringExecutor.setAdminAddresses(adminAddresses); xxlJobSpringExecutor.setAppName(appName); xxlJobSpringExecutor.setIp(ip); xxlJobSpringExecutor.setPort(port); xxlJobSpringExecutor.setAccessToken(accessToken); xxlJobSpringExecutor.setLogPath(logPath); xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); return xxlJobSpringExecutor; } }
以上就是小编今天的分享了,希望可以帮助到大家。