Skip to content

Commit 2f1a25f

Browse files
committed
使用Elastic Job的namespace防止任务名冲突
1 parent 134940d commit 2f1a25f

File tree

6 files changed

+6
-4
lines changed

6 files changed

+6
-4
lines changed

2.x/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
- [Spring Boot 2.x基础教程:使用@Scheduled实现定时任务](https://blog.didispace.com/spring-boot-learning-2-7-1)
8585
- [Spring Boot 2.x基础教程:使用Elastic Job实现定时任务](https://blog.didispace.com/spring-boot-learning-2-7-2)
8686
- [Spring Boot 2.x基础教程:使用Elastic Job的分片配置](https://blog.didispace.com/spring-boot-learning-2-7-3)
87-
87+
- [Spring Boot 2.x基础教程:使用Elastic Job的namespace防止任务名冲突](https://blog.didispace.com/spring-boot-learning-2-7-4)
8888

8989
### 常见问题
9090

2.x/README_zh.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
- [Spring Boot 2.x基础教程:使用@Scheduled实现定时任务](https://blog.didispace.com/spring-boot-learning-2-7-1)
8686
- [Spring Boot 2.x基础教程:使用Elastic Job实现定时任务](https://blog.didispace.com/spring-boot-learning-2-7-2)
8787
- [Spring Boot 2.x基础教程:使用Elastic Job的分片配置](https://blog.didispace.com/spring-boot-learning-2-7-3)
88+
- [Spring Boot 2.x基础教程:使用Elastic Job的namespace防止任务名冲突](https://blog.didispace.com/spring-boot-learning-2-7-4)
8889

8990
### 常见问题
9091

2.x/chapter7-4/src/main/java/com/didispace/chapter74/Chapter74Application.java

100755100644
File mode changed.

2.x/chapter7-4/src/main/java/com/didispace/chapter74/MySimpleJob.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public class MySimpleJob implements SimpleJob {
1212
@Override
1313
public void execute(ShardingContext context) {
1414
log.info("MySimpleJob start : didispace.com {}", System.currentTimeMillis());
15-
throw new RuntimeException("模拟任务出现异常");
1615
}
1716

1817
}

2.x/chapter7-4/src/main/resources/application.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
spring.application.name=chapter74
2+
13
elasticjob.reg-center.server-lists=localhost:2181
2-
elasticjob.reg-center.namespace=didispace
4+
elasticjob.reg-center.namespace=${spring.application.name}
35

46
elasticjob.jobs.my-simple-job.elastic-job-class=com.didispace.chapter74.MySimpleJob
57
elasticjob.jobs.my-simple-job.cron=0/5 * * * * ?

2.x/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
<module>chapter7-1</module> <!-- 7-1 使用@Scheduled实现定时任务 -->
7373
<module>chapter7-2</module> <!-- 7-2 使用Elastic Job实现定时任务 -->
7474
<module>chapter7-3</module> <!-- 7-3 使用Elastic Job的分片配置 -->
75-
<module>chapter7-4</module> <!-- 7-4 Elastic Job的错误处理策略 -->
75+
<module>chapter7-4</module> <!-- 7-4 使用Elastic Job的namespace防止任务名冲突 -->
7676
<!-- 7-5 简单异步任务 -->
7777

7878
</modules>

0 commit comments

Comments
 (0)