parent
039bd7f203
commit
caf670f914
@ -0,0 +1,64 @@
|
|||||||
|
<?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.xuxueli</groupId>
|
||||||
|
<artifactId>xxl-job</artifactId>
|
||||||
|
<version>2.3.0</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>xxl-job-boot-starter-executor</artifactId>
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>Example executor project for spring boot.</description>
|
||||||
|
<url>https://www.xuxueli.com/</url>
|
||||||
|
<properties>
|
||||||
|
</properties>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<!-- xxl-job-core -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.xuxueli</groupId>
|
||||||
|
<artifactId>xxl-job-core</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.xxl.job.core.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
/**
|
||||||
|
* 读取应用的配置参数
|
||||||
|
* @author cqyhm
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Setter@Getter@ToString
|
||||||
|
@ConfigurationProperties(prefix = ApplicationProperties.PREFIX, ignoreInvalidFields = true)
|
||||||
|
public class ApplicationProperties {
|
||||||
|
/**
|
||||||
|
* 配置前缀
|
||||||
|
*/
|
||||||
|
public static final String PREFIX = "spring.application";
|
||||||
|
/**
|
||||||
|
* 应用程序名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.xxl.job.core.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
/**
|
||||||
|
* 获取定时任务相关的配置参数
|
||||||
|
* @author cqyhm
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Setter@Getter@ToString
|
||||||
|
@ConfigurationProperties(prefix = JobConfigProperties.PREFIX, ignoreInvalidFields = true)
|
||||||
|
public class JobConfigProperties {
|
||||||
|
|
||||||
|
public static final String PREFIX = "xxl.job";
|
||||||
|
/**
|
||||||
|
* 通讯令牌
|
||||||
|
*/
|
||||||
|
private String accessToken;
|
||||||
|
/**
|
||||||
|
* 调度器设置
|
||||||
|
*/
|
||||||
|
private Admin admin;
|
||||||
|
/**
|
||||||
|
* 执行器设置
|
||||||
|
*/
|
||||||
|
private Executor executor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Admin {
|
||||||
|
/**
|
||||||
|
* 调度器地址端口多个可以用逗号隔开
|
||||||
|
*/
|
||||||
|
private String addresses;
|
||||||
|
}
|
||||||
|
@Data
|
||||||
|
public static class Executor {
|
||||||
|
/**
|
||||||
|
* 执行器的名称(唯一编码,默认为当前应用程序的名称作为调度器的名称)
|
||||||
|
*/
|
||||||
|
private String appname;
|
||||||
|
/**
|
||||||
|
* 执行器运行地址为空=ip:port
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
/**
|
||||||
|
* 执行器所在的本机地址
|
||||||
|
*/
|
||||||
|
private String ip="";
|
||||||
|
/**
|
||||||
|
* 执行器监控的端口
|
||||||
|
*/
|
||||||
|
private Integer port=0;
|
||||||
|
/**
|
||||||
|
* 日志路径
|
||||||
|
*/
|
||||||
|
private String logpath;
|
||||||
|
/**
|
||||||
|
* 日志保留天数
|
||||||
|
*/
|
||||||
|
private Integer logretentiondays;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "xxl.job.enabled",
|
||||||
|
"type": "java.lang.Boolean",
|
||||||
|
"defaultValue": "true",
|
||||||
|
"description": "是否启用任务执行器,默认启动true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "xxl.job.accessToken",
|
||||||
|
"type": "java.lang.String",
|
||||||
|
"defaultValue": "",
|
||||||
|
"description": "调度时的通讯令牌."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "xxl.job.admin.addresses",
|
||||||
|
"type": "java.lang.String",
|
||||||
|
"defaultValue": "http://localhost:8080/xxl-job-admin/",
|
||||||
|
"description": "执行器连接调度中心的地址"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "xxl.job.executor.appname",
|
||||||
|
"type": "java.lang.String",
|
||||||
|
"defaultValue": "${spring.application.name}",
|
||||||
|
"description": "默认是微服务的名称"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "xxl.job.executor.logpath",
|
||||||
|
"type": "java.lang.String",
|
||||||
|
"defaultValue": "执行器日志输出路径",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "xxl.job.executor.logretentiondays",
|
||||||
|
"type": "java.lang.Integer",
|
||||||
|
"defaultValue": "7",
|
||||||
|
"description": "执行器日志保留天数"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "xxl.job.executor.port",
|
||||||
|
"type": "java.lang.Integer",
|
||||||
|
"description": "执行器监控调度的端口."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "xxl.job.executor.ip",
|
||||||
|
"type": "java.lang.String",
|
||||||
|
"description": "执行器所在机器的IP地址"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "xxl.job.executor.address",
|
||||||
|
"type": "java.lang.String",
|
||||||
|
"description": "执行器所在机器的地址,如果为空则使用ip:port"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||||
|
com.xxl.job.core.config.JobAutoConfiguration
|
@ -1,26 +1,28 @@
|
|||||||
# web port
|
# web port
|
||||||
server.port=8081
|
server:
|
||||||
|
port: 8081
|
||||||
# no web
|
# no web
|
||||||
#spring.main.web-environment=false
|
#spring.main.web-environment=false
|
||||||
|
spring:
application:
name: xxl-job-executor-sample
|
||||||
# log config
|
# log config
|
||||||
logging.config=classpath:logback.xml
|
logging:
|
||||||
|
config: classpath:logback.xml
|
||||||
|
|
||||||
### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
|
### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
|
||||||
xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
|
xxl:
|
||||||
|
job:
|
||||||
### xxl-job, access token
|
admin:
|
||||||
xxl.job.accessToken=
|
addresses: http://127.0.0.1:8080/xxl-job-admin
|
||||||
|
accessToken: ### xxl-job, access token
|
||||||
### xxl-job executor appname
|
### xxl-job executor appname
|
||||||
xxl.job.executor.appname=xxl-job-executor-sample
|
executor:
|
||||||
|
# appname: xxl-job-executor-sample
|
||||||
### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null
|
### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null
|
||||||
xxl.job.executor.address=
|
address:
|
||||||
### xxl-job executor server-info
|
### xxl-job executor server-info
|
||||||
xxl.job.executor.ip=
|
ip:
|
||||||
xxl.job.executor.port=9999
|
port: 9999
|
||||||
### xxl-job executor log-path
|
### xxl-job executor log-path
|
||||||
xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler
|
logpath: /data/applogs/xxl-job/jobhandler
|
||||||
### xxl-job executor log-retention-days
|
### xxl-job executor log-retention-days
|
||||||
xxl.job.executor.logretentiondays=30
|
logretentiondays: 30
|
Loading…
Reference in new issue