Skip to content

Commit

Permalink
✨ Introducing new features. support xxl-job and auto set appname
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwNB committed Sep 16, 2020
1 parent f527555 commit 8413ca6
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 171 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ pig
└── pig-visual
└── pig-monitor -- spring boot admin[5001]
├── pig-codegen -- graphical code generation[5002]
└── pig-sentinel-dashboard -- sentinel dashboard [5003]
└── pig-xxl-job -- distributed task scheduling [5004]
└── pig-sentinel-dashboard -- sentinel dashboard [5003]
```
#### Open source co-construction

Expand Down
1 change: 0 additions & 1 deletion README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ pig
└── pig-monitor -- 服务监控 [5001]
├── pig-codegen -- 图形化代码生成 [5002]
└── pig-sentinel-dashboard -- 流量高可用 [5003]
└── pig-xxl-job -- 分布式任务调度 [5004]
```

#### 开源共建
Expand Down
16 changes: 0 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,3 @@ services:
container_name: pig-codegen
hostname: pig-codegen
image: pig-codegen

pig-xxl-job:
build:
context: ./pig-visual/pig-xxl-job
restart: always
image: pig-xxl-job
container_name: pig-xxl-job

pig-xxl-job-admin:
container_name: pig-xxl-job-admin
image: xuxueli/xxl-job-admin:2.2.0
restart: always
environment:
PARAMS: "--server.port=8080 --spring.datasource.url=jdbc:mysql://pig-mysql:3306/pig_job?Unicode=true&characterEncoding=UTF-8 --spring.datasource.username=root --spring.datasource.password=root"
ports:
- 8080:8080
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.pig4cloud.pig.common.job.annotation;

import com.pig4cloud.pig.common.job.properties.XxlJobProperties;
import com.pig4cloud.pig.common.job.XxlJobAutoConfiguration;
import org.springframework.context.annotation.Import;

import java.lang.annotation.*;
Expand All @@ -15,7 +15,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@Import({ XxlJobProperties.class })
@Import({ XxlJobAutoConfiguration.class })
public @interface EnablePigXxlJob {

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public class XxlAdminProperties {
/**
* 调度中心部署跟地址 [选填]:如调度中心集群部署存在多个地址则用逗号分隔。 执行器将会使用该地址进行"执行器心跳注册"和"任务结果回调";为空则关闭自动注册;
*/
private String addresses = "http://127.0.0.1:8080/xxl-job-admin";
private String addresses = "http://pig-job:8080/xxl-job-admin";

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class XxlExecutorProperties {
/**
* 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册
*/
private String appname = "xxl-job-executor";
private String appname;

/**
* 服务注册地址,优先使用该配置作为注册地址 为空时使用内嵌服务 ”IP:PORT“ 作为注册地址 从而更灵活的支持容器类型执行器动态IP和动态映射端口问题
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package com.pig4cloud.pig.common.job.properties;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

/**
* xxl-job配置
Expand All @@ -13,10 +17,28 @@
@Data
@Component
@ConfigurationProperties(prefix = "xxl.job")
public class XxlJobProperties {
public class XxlJobProperties implements InitializingBean, EnvironmentAware {

private Environment environment;

private XxlAdminProperties admin = new XxlAdminProperties();

private XxlExecutorProperties executor = new XxlExecutorProperties();

@Override
public void afterPropertiesSet() {
// 若是没有设置appname 则取 application Name
if (StringUtils.isEmpty(executor.getAppname())) {
executor.setAppname(environment.getProperty("spring.application.name"));
}
}

/**
* Set the {@code Environment} that this component runs in.
*/
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}

}
17 changes: 0 additions & 17 deletions pig-visual/pig-xxl-job/Dockerfile

This file was deleted.

62 changes: 0 additions & 62 deletions pig-visual/pig-xxl-job/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions pig-visual/pig-xxl-job/src/main/resources/bootstrap.yml

This file was deleted.

1 change: 0 additions & 1 deletion pig-visual/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@
<module>pig-codegen</module>
<module>pig-monitor</module>
<module>pig-sentinel-dashboard</module>
<module>pig-xxl-job</module>
</modules>
</project>

0 comments on commit 8413ca6

Please sign in to comment.