Merge remote-tracking branch 'origin/dev_2.2.0' into dev_2.2.0

This commit is contained in:
byteblogs168 2023-08-18 07:47:10 +08:00
commit 1b8ffc0d04
11 changed files with 31 additions and 36 deletions

View File

@ -38,10 +38,6 @@
<groupId>com.github.rholder</groupId>
<artifactId>guava-retrying</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>com.aizuda</groupId>
<artifactId>easy-retry-common-core</artifactId>

View File

@ -22,6 +22,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
@ -43,7 +44,15 @@
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<artifactId>hutool-http</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-extra</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-crypto</artifactId>
</dependency>
</dependencies>

View File

@ -38,7 +38,7 @@
</dependency>
<dependency>
<groupId>com.aizuda</groupId>
<artifactId>easy-retry-client-core</artifactId>
<artifactId>easy-retry-common-server-api</artifactId>
</dependency>
</dependencies>

View File

@ -1,6 +1,6 @@
package com.aizuda.easy.retry.template.datasource.enums;
import com.aizuda.easy.retry.client.core.exception.EasyRetryClientException;
import com.aizuda.easy.retry.template.datasource.exception.EasyRetryDatasourceException;
import com.baomidou.mybatisplus.annotation.DbType;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -32,6 +32,6 @@ public enum DbTypeEnum {
}
}
throw new EasyRetryClientException("暂不支持此数据库 [{}]", db);
throw new EasyRetryDatasourceException("暂不支持此数据库 [{}]", db);
}
}

View File

@ -1,6 +1,6 @@
package com.aizuda.easy.retry.template.datasource.utils;
import com.aizuda.easy.retry.client.core.exception.EasyRetryClientException;
import com.aizuda.easy.retry.template.datasource.exception.EasyRetryDatasourceException;
import com.aizuda.easy.retry.template.datasource.persistence.mapper.GroupConfigMapper;
import com.aizuda.easy.retry.template.datasource.persistence.po.GroupConfig;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -58,7 +58,7 @@ public class RequestDataHelper {
public static void setPartition(String groupName) {
if (StringUtils.isBlank(groupName)) {
throw new EasyRetryClientException("组名称不能为空");
throw new EasyRetryDatasourceException("组名称不能为空");
}
GroupConfigMapper groupConfigMapper = SpringContext.getBeanByType(GroupConfigMapper.class);
@ -66,7 +66,7 @@ public class RequestDataHelper {
GroupConfig groupConfig = groupConfigMapper.selectOne(new LambdaQueryWrapper<GroupConfig>()
.eq(GroupConfig::getGroupName, groupName));
if (Objects.isNull(groupConfig)) {
throw new EasyRetryClientException("groupName:[{}]不存在", groupName);
throw new EasyRetryDatasourceException("groupName:[{}]不存在", groupName);
}
setPartition(groupConfig.getGroupPartition());

View File

@ -25,10 +25,6 @@
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.aizuda</groupId>
<artifactId>easy-retry-common-core</artifactId>
</dependency>
<dependency>
<groupId>com.aizuda</groupId>
<artifactId>easy-retry-datasource-template</artifactId>

View File

@ -25,14 +25,6 @@
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.aizuda</groupId>
<artifactId>easy-retry-common-core</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>

View File

@ -25,14 +25,6 @@
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.aizuda</groupId>
<artifactId>easy-retry-common-core</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.aizuda</groupId>
<artifactId>easy-retry-datasource-template</artifactId>

View File

@ -77,10 +77,6 @@
<groupId>com.aizuda</groupId>
<artifactId>easy-retry-common-client-api</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>

View File

@ -1,6 +1,7 @@
package com.aizuda.easy.retry.server;
import com.aizuda.easy.retry.server.server.NettyHttpServer;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
@ -18,6 +19,7 @@ import java.util.concurrent.TimeUnit;
@SpringBootApplication
@EnableTransactionManagement(proxyTargetClass = true)
@Slf4j
public class EasyRetryServerApplication {
@Bean
@ -39,11 +41,13 @@ public class EasyRetryServerApplication {
// 最长自旋10秒保证nettyHttpServer启动完成
int waitCount = 0;
while (!nettyHttpServer.isStarted() || waitCount > 100) {
log.info("--------> easy-retry netty server is staring....");
TimeUnit.MILLISECONDS.sleep(100);
waitCount++;
}
if (!nettyHttpServer.isStarted()) {
log.error("--------> easy-retry netty server startup failure.");
// Netty启动失败停止Web服务和Spring Boot应用程序
serverFactory.getWebServer().stop();
SpringApplication.exit(SpringApplication.run(EasyRetryServerApplication.class));

12
pom.xml
View File

@ -89,7 +89,17 @@
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<artifactId>hutool-http</artifactId>
<version>${hutool-all.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-extra</artifactId>
<version>${hutool-all.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-crypto</artifactId>
<version>${hutool-all.version}</version>
</dependency>
<dependency>