初始化
commit
d4df7efb9b
|
@ -0,0 +1,8 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="cloud-common-xxl" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="http://101.132.33.172:8081/repository/maven-public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="public" />
|
||||||
|
<option name="name" value="aliyun nexus" />
|
||||||
|
<option name="url" value="https://maven.aliyun.com/repository/public" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="public" />
|
||||||
|
<option name="name" value="aliyun nexus" />
|
||||||
|
<option name="url" value="http://101.132.33.172:8081/repository/maven-public/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="MavenRunner">
|
||||||
|
<option name="delegateBuildToMaven" value="true" />
|
||||||
|
<option name="jreName" value="1.8" />
|
||||||
|
<option name="skipTests" value="true" />
|
||||||
|
<option name="vmOptions" value="-DarchetypeCatalog=internal" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-common-xxl</artifactId>
|
||||||
|
|
||||||
|
<description>XllJob定时任务</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- MuYu Common Core-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- xxl-job-core -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.xuxueli</groupId>
|
||||||
|
<artifactId>xxl-job-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.common.xxl;
|
||||||
|
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@Component
|
||||||
|
public class XXLJobConfig {
|
||||||
|
@Bean
|
||||||
|
public XxlJobSpringExecutor xxlJobExecutor(XxlJobProperties xxlJobProperties) {
|
||||||
|
if (StringUtils.isEmpty(xxlJobProperties.getAdminAddresses())){
|
||||||
|
throw new RuntimeException("请在bootstrap.yml当中配置shared-configs项,xxl-job共享配置[application-xxl-config]");
|
||||||
|
}
|
||||||
|
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||||
|
xxlJobSpringExecutor.setAdminAddresses(xxlJobProperties.getAdminAddresses());
|
||||||
|
xxlJobSpringExecutor.setAppname(xxlJobProperties.getAppName());
|
||||||
|
xxlJobSpringExecutor.setIp(xxlJobProperties.getIp());
|
||||||
|
xxlJobSpringExecutor.setPort(xxlJobProperties.getPort());
|
||||||
|
xxlJobSpringExecutor.setAccessToken(xxlJobProperties.getAccessToken());
|
||||||
|
xxlJobSpringExecutor.setLogPath(xxlJobProperties.getLogPath());
|
||||||
|
xxlJobSpringExecutor.setLogRetentionDays(xxlJobProperties.getLogRetentionDays());
|
||||||
|
log.info(">>>>>>>>>>> xxl-job config init success.");
|
||||||
|
return xxlJobSpringExecutor;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.common.xxl;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "xxl-job")
|
||||||
|
public class XxlJobProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调度中心部署根地址 [选填]:
|
||||||
|
* 如调度中心集群部署存在多个地址则用逗号分隔。执行器将会使用该地址进行"执行器心跳注册"和"任务结果回调";
|
||||||
|
* 为空则关闭自动注册;
|
||||||
|
*/
|
||||||
|
private String adminAddresses;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行器通讯TOKEN [选填]:
|
||||||
|
* 非空时启用;
|
||||||
|
*/
|
||||||
|
private String accessToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行器AppName [选填]:
|
||||||
|
* 执行器心跳注册分组依据;为空则关闭自动注册
|
||||||
|
*/
|
||||||
|
private String appName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行器注册 [选填]:
|
||||||
|
* 优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。
|
||||||
|
* 从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行器IP [选填]:
|
||||||
|
* 默认为空表示自动获取IP,多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用;
|
||||||
|
* 地址信息用于 "执行器注册" 和 "调度中心请求并触发任务";
|
||||||
|
*/
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行器端口号 [选填]:
|
||||||
|
* 小于等于0则自动获取;默认端口为9999,
|
||||||
|
* 单机部署多个执行器时,注意要配置不同执行器端口;
|
||||||
|
*/
|
||||||
|
private int port;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行器运行日志文件存储磁盘路径 [选填]:
|
||||||
|
* 需要对该路径拥有读写权限;为空则使用默认路径;
|
||||||
|
*/
|
||||||
|
private String logPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行器日志文件保存天数 [选填]:
|
||||||
|
* 过期日志自动清理, 限制值大于等于3时生效; 否则, 如-1, 关闭自动清理功能;
|
||||||
|
*/
|
||||||
|
private int logRetentionDays;
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.common.xxl.demo;
|
||||||
|
|
||||||
|
import com.xxl.job.core.context.XxlJobHelper;
|
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@Component
|
||||||
|
public class XxlJobDemoService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无参测试
|
||||||
|
*/
|
||||||
|
@XxlJob("xxl-job-demo-no-param")
|
||||||
|
public void xxlJobDemoNoParam(){
|
||||||
|
log.info("调度名称:[{}] - 无参", "xxl-job-demo-no-param");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有参测试
|
||||||
|
*/
|
||||||
|
@XxlJob("xxl-job-demo-one-param")
|
||||||
|
public void xxlJobDemoOneParam(){
|
||||||
|
String param = XxlJobHelper.getJobParam();
|
||||||
|
log.info("调度名称:[{}] - 参数:[{}]", "xxl-job-demo-one-param", param);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
com.muyu.common.xxl.XXLJobConfig
|
||||||
|
com.muyu.common.xxl.XxlJobProperties
|
||||||
|
com.muyu.common.xxl.demo.XxlJobDemoService
|
|
@ -0,0 +1,3 @@
|
||||||
|
com.muyu.common.xxl.XXLJobConfig
|
||||||
|
com.muyu.common.xxl.XxlJobProperties
|
||||||
|
com.muyu.common.xxl.demo.XxlJobDemoService
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,5 @@
|
||||||
|
#Generated by Maven
|
||||||
|
#Wed Jul 24 20:47:47 CST 2024
|
||||||
|
groupId=com.muyu
|
||||||
|
artifactId=cloud-common-xxl
|
||||||
|
version=3.6.3
|
|
@ -0,0 +1,3 @@
|
||||||
|
com\muyu\common\xxl\demo\XxlJobDemoService.class
|
||||||
|
com\muyu\common\xxl\XXLJobConfig.class
|
||||||
|
com\muyu\common\xxl\XxlJobProperties.class
|
|
@ -0,0 +1,3 @@
|
||||||
|
D:\workspace-IceCeram-Cloud-master\zglchaifen\cloud-common-xxl\src\main\java\com\muyu\common\xxl\demo\XxlJobDemoService.java
|
||||||
|
D:\workspace-IceCeram-Cloud-master\zglchaifen\cloud-common-xxl\src\main\java\com\muyu\common\xxl\XxlJobProperties.java
|
||||||
|
D:\workspace-IceCeram-Cloud-master\zglchaifen\cloud-common-xxl\src\main\java\com\muyu\common\xxl\XXLJobConfig.java
|
Loading…
Reference in New Issue