fix: 2.1.0

1. 升级依赖包版本
2. 修改getBlacklist NPE问题
3. 删除hibernate-validator包使用spring-boot-starter-validation
This commit is contained in:
byteblogs168 2023-07-17 18:38:37 +08:00
parent 018357cada
commit 0afc0b489f
16 changed files with 47 additions and 125 deletions

View File

@ -1,22 +1,24 @@
<p align="center">
<a href="https://gitee.com/aizuda/easy-retry">
<a href="https://www.easyretry.com">
<img alt="Easy-Retry-Logo" src="doc/images/logo.png">
</a>
</p>
<p align="center">
分布式重试服务平台 Easy-Retry
🔥🔥🔥基于BASE思想实现的分布式服务重试组件
</p>
# 简介
>在分布式系统大行其道的当前系统数据的准确性和正确性是重大的挑战基于CAP理论采用柔性事务保障系统可用性以及数据的最终一致性成为技术共识
>为了保障分布式服务的可用性,服务容错性,服务数据一致性 以及服务间掉用的网络问题。依据"墨菲定律",增加核心流程重试,数据核对校验成为提高系统鲁棒性常用的技术方案
>
> 在当前广泛流行的分布式系统中确保系统数据的一致性和正确性是一项重大挑战。为了解决分布式事务问题涌现了许多理论和业务实践其中BASE理论是目前业界广泛接受的分布式一致性理论。
> 基于BASE理论采用柔性事务并优先保障系统的可用性和数据的最终一致性已逐渐成为技术共识。
> 为了确保分布式服务的可用性和数据一致性,并防止由于网络抖动、连接超时等问题导致短时不可用的情况,根据"墨菲定律",在核心流程中增加重试和数据核对校验的动作成为提高系统鲁棒性常用的技术方案。
> 在此背景下EasyRetry应运而生。EasyRetry是一款基于BASE思想实现的分布式服务重试组件旨在通过重试机制确保数据的最终一致性。它提供了控制台任务观测、可配置的重试策略、重试后执行回调以及丰富地告警配置等功能。通过这些手段可以对异常数据进行全面监测和回放从而在确保系统高可用性的同时大大提升数据的一致性。
> 通常的业务场景有:
> + 保障系统稳定性,减少网络抖动导致异常,增加重试能力
>+ 保障系统稳定性,减少网络抖动导致异常,增加重试能力
>+ 保障服务容错性,对核心流程进行拆分,在业务低峰期进行数据核对
>+ 保证信息的可达性,在服务间通知时增加重试
>
@ -41,14 +43,13 @@
## 相关链接
- [字节跳动: 如何优雅地重试](https://juejin.cn/post/6914091859463634951)
- [文档](https://www.easyretry.com/pages/a2f161/)
- [功能实例](https://www.easyretry.com/pages/960e25/)
- [文档](https://www.easyretry.com/pages/d1d1da/)
- [HelloWorld](https://www.easyretry.com/pages/da9ecc/)
## 原理
- [客户端原理剖析](https://gitee.com/aizuda/easy-retry/tree/dev/example)
- [服务端原理剖析](https://gitee.com/aizuda/easy-retry/tree/dev/example)
- [架构与功能](https://www.easyretry.com/pages/540554/)
## 应用实例
- [Spring-Boot](https://gitee.com/aizuda/easy-retry/tree/dev/example)
- [Spring-Boot](https://gitee.com/zhangyutongxue/easy-retry-demo)
## 期望
欢迎提出更好的意见,帮助完善 Easy-Retry

View File

@ -25,10 +25,6 @@
<artifactId>spring-boot-starter-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
@ -48,11 +44,6 @@
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.aizuda</groupId>
<artifactId>easy-retry-common-core</artifactId>

View File

@ -60,7 +60,7 @@ public class RetryEndPoint {
* 服务端调度重试入口
*/
@PostMapping("/dispatch/v1")
public Result<DispatchRetryResultDTO> dispatch(@RequestBody DispatchRetryDTO executeReqDto) {
public Result<DispatchRetryResultDTO> dispatch(@RequestBody @Validated DispatchRetryDTO executeReqDto) {
RetryerInfo retryerInfo = RetryerInfoCache.get(executeReqDto.getScene(), executeReqDto.getExecutorName());
if (Objects.isNull(retryerInfo)) {
@ -119,7 +119,7 @@ public class RetryEndPoint {
}
@PostMapping("/callback/v1")
public Result callback(@RequestBody RetryCallbackDTO callbackDTO) {
public Result callback(@RequestBody @Validated RetryCallbackDTO callbackDTO) {
RetryerInfo retryerInfo = RetryerInfoCache.get(callbackDTO.getScene(), callbackDTO.getExecutorName());
if (Objects.isNull(retryerInfo)) {
throw new EasyRetryClientException("场景:[{}]配置不存在", callbackDTO.getScene());

View File

@ -1,8 +0,0 @@
package com.x.retry.common.client.core.xretryclientcore;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class XRetryClientCoreApplicationTests {
}

View File

@ -20,18 +20,17 @@
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<artifactId>spring-boot-starter-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.aizuda</groupId>
<artifactId>easy-retry-client-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,13 +0,0 @@
package com.x.retry.common.client.starter.xretryclientstarter;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class XRetryClientStarterApplicationTests {
@Test
void contextLoads() {
}
}

View File

@ -21,7 +21,7 @@
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
@ -34,10 +34,6 @@
<groupId>com.aizuda</groupId>
<artifactId>easy-retry-common-core</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -23,26 +23,19 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.8</version>
<version>1.10</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>

View File

@ -19,23 +19,19 @@
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>com.aizuda</groupId>
<artifactId>easy-retry-common-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
</dependencies>

View File

@ -24,28 +24,4 @@
<module>easy-retry-common-core</module>
</modules>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<!-- <build>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <excludes>-->
<!-- <exclude>-->
<!-- <groupId>org.projectlombok</groupId>-->
<!-- <artifactId>lombok</artifactId>-->
<!-- </exclude>-->
<!-- </excludes>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
</project>

View File

@ -18,13 +18,14 @@
<java.version>1.8</java.version>
<maven.deploy.skip>true</maven.deploy.skip>
<org.mapstruct.version>1.5.3.Final</org.mapstruct.version>
<akka.version>2.6.20</akka.version>
<java-jwt.version>4.3.0</java-jwt.version>
<akka.version>2.6.21</akka.version>
<java-jwt.version>4.4.0</java-jwt.version>
<shedlock.version>4.0.1</shedlock.version>
<okhttp.version>4.10.0</okhttp.version>
<okhttp.version>5.0.0-alpha.11</okhttp.version>
<commons-lang.version>2.6</commons-lang.version>
<perf4j.version>0.9.16</perf4j.version>
<mysql.version>8.0.32</mysql.version>
<mysql.version>8.0.33</mysql.version>
<guava.version>32.0.0-jre</guava.version>
</properties>
<dependencies>
@ -32,6 +33,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
@ -50,7 +55,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
@ -133,16 +138,6 @@
<artifactId>perf4j</artifactId>
<version>${perf4j.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>13.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

View File

@ -10,6 +10,7 @@ import org.springframework.util.CollectionUtils;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@ -62,6 +63,9 @@ public class MybatisConfigAccess extends AbstractConfigAccess {
public Set<String> getBlacklist(String groupName) {
GroupConfig groupConfig = getByGroupName(groupName);
if (Objects.isNull(groupConfig)) {
return Collections.EMPTY_SET;
}
LambdaQueryWrapper<SceneConfig> sceneConfigLambdaQueryWrapper = new LambdaQueryWrapper<SceneConfig>()
.eq(SceneConfig::getSceneName, groupName);

View File

@ -23,7 +23,6 @@ public interface TaskGenerator {
* 任务生成器
*
* @param taskContext 任务列表
* @return 成功处理的数据量
*/
void taskGenerator(TaskContext taskContext);
}

View File

@ -5,9 +5,11 @@ import lombok.Data;
import java.util.List;
/**
* 任务生成器上下文
*
* @author www.byteblogs.com
* @date 2023-07-16 21:26:52
* @since
* @since 2.1.0
*/
@Data
public class TaskContext {

View File

@ -2,9 +2,6 @@ package com.aizuda.easy.retry.server.web.model.request;
import com.aizuda.easy.retry.server.web.model.base.BaseQueryVO;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**

14
pom.xml
View File

@ -21,12 +21,11 @@
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<revision>2.0.1</revision>
<revision>2.1.0-SNAPSHOT</revision>
<dingding-talk.version>1.0.0</dingding-talk.version>
<hibernate-validator.version>5.4.2.Final</hibernate-validator.version>
<netty-all.version>4.1.48.Final</netty-all.version>
<hutool-all.version>5.7.21</hutool-all.version>
<mybatis-plus.version>3.5.1</mybatis-plus.version>
<netty-all.version>4.1.94.Final</netty-all.version>
<hutool-all.version>5.8.19</hutool-all.version>
<mybatis-plus.version>3.5.3.1</mybatis-plus.version>
<alibaba-dingtalk.version>2.0.0</alibaba-dingtalk.version>
</properties>
@ -82,11 +81,6 @@
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
</dependencies>
</dependencyManagement>