feat: 3.2.0

1. 修复启动失败
2. 维护sql脚本
This commit is contained in:
byteblogs168 2024-03-28 09:25:49 +08:00
parent ffe8b7bac9
commit 8da3661f20
7 changed files with 20 additions and 20 deletions

View File

@ -412,7 +412,7 @@ CREATE TABLE `job_summary`
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`namespace_id` VARCHAR(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
`group_name` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '组名称',
`job_id` bigint NOT NULL COMMENT '任务信息id',
ji `business_id` bigint NOT NULL COMMENT '业务id (job_id或workflow_id)',
`trigger_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '统计时间',
`success_num` int NOT NULL DEFAULT '0' COMMENT '执行成功-日志数量',
`fail_num` int NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量',
@ -424,8 +424,8 @@ CREATE TABLE `job_summary`
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
KEY `idx_namespace_id_group_name_job_id` (`namespace_id`, `group_name`, job_id),
UNIQUE KEY `uk_job_id_trigger_at` (`job_id`, `trigger_at`) USING BTREE
KEY `idx_namespace_id_group_name_business_id` (`namespace_id`, `group_name`, business_id),
UNIQUE KEY `uk_business_id_trigger_at` (`business_id`, `trigger_at`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8mb4 COMMENT ='DashBoard_Job';

View File

@ -123,7 +123,7 @@ public class EasyRetryProperties {
}
public static String getGroup() {
EasyRetryProperties properties = SpringContext.CONTEXT.getBean(EasyRetryProperties.class);
EasyRetryProperties properties = SpringContext.getBean(EasyRetryProperties.class);
return Objects.requireNonNull(properties).group;
}
}

View File

@ -6,6 +6,7 @@ import com.aizuda.easy.retry.client.common.event.EasyRetryClosingEvent;
import com.aizuda.easy.retry.client.common.event.EasyRetryStartingEvent;
import com.aizuda.easy.retry.common.core.context.SpringContext;
import com.aizuda.easy.retry.common.core.util.EasyRetryVersion;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
@ -22,18 +23,17 @@ import java.util.List;
* @since 1.0.0
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class EasyRetryCloseListener implements ApplicationListener<ContextClosedEvent> {
@Autowired
private List<Lifecycle> lifecycleList;
private final List<Lifecycle> lifecycleList;
@Override
public void onApplicationEvent(ContextClosedEvent event) {
log.info("Easy-Retry client about to shutdown v{}", EasyRetryVersion.getVersion());
SpringContext.CONTEXT.publishEvent(new EasyRetryClosingEvent());
SpringContext.getContext().publishEvent(new EasyRetryClosingEvent());
lifecycleList.forEach(Lifecycle::close);
SpringContext.CONTEXT.publishEvent(new EasyRetryClosedEvent());
SpringContext.getContext().publishEvent(new EasyRetryClosedEvent());
log.info("Easy-Retry client closed successfully v{}", EasyRetryVersion.getVersion());
}
}

View File

@ -37,9 +37,9 @@ public class EasyRetryStartListener implements ApplicationRunner {
System.out.println(MessageFormatter.format(SystemConstants.LOGO, EasyRetryVersion.getVersion()).getMessage());
EasyRetryLog.LOCAL.info("Easy-Retry client is preparing to start... v{}", EasyRetryVersion.getVersion());
SpringContext.CONTEXT.publishEvent(new EasyRetryStartingEvent());
SpringContext.getContext().publishEvent(new EasyRetryStartingEvent());
lifecycleList.forEach(Lifecycle::start);
SpringContext.CONTEXT.publishEvent(new EasyRetryStartedEvent());
SpringContext.getContext().publishEvent(new EasyRetryStartedEvent());
isStarted = true;
EasyRetryLog.LOCAL.info("Easy-Retry client started successfully v{}", EasyRetryVersion.getVersion());
}

View File

@ -69,7 +69,7 @@ public class NettyChannel {
* @return port
*/
public static int getServerPort() {
EasyRetryProperties easyRetryProperties = SpringContext.CONTEXT.getBean(EasyRetryProperties.class);
EasyRetryProperties easyRetryProperties = SpringContext.getContext().getBean(EasyRetryProperties.class);
EasyRetryProperties.ServerConfig serverConfig = easyRetryProperties.getServer();
String port = System.getProperty(EASY_RETRY_SERVER_PORT);
@ -86,7 +86,7 @@ public class NettyChannel {
* @return host
*/
public static String getServerHost() {
EasyRetryProperties easyRetryProperties = SpringContext.CONTEXT.getBean(EasyRetryProperties.class);
EasyRetryProperties easyRetryProperties = SpringContext.getBean(EasyRetryProperties.class);
EasyRetryProperties.ServerConfig serverConfig = easyRetryProperties.getServer();
String host = System.getProperty(EASY_RETRY_SERVER_HOST);
@ -103,7 +103,7 @@ public class NettyChannel {
* @return 客户端IP
*/
public static String getClientHost() {
EasyRetryProperties easyRetryProperties = SpringContext.CONTEXT.getBean(EasyRetryProperties.class);
EasyRetryProperties easyRetryProperties = SpringContext.getBean(EasyRetryProperties.class);
String host = easyRetryProperties.getHost();
// 获取客户端指定的IP地址
@ -120,8 +120,8 @@ public class NettyChannel {
* @return port 端口
*/
public static Integer getClientPort() {
EasyRetryProperties easyRetryProperties = SpringContext.CONTEXT.getBean(EasyRetryProperties.class);
ServerProperties serverProperties = SpringContext.CONTEXT.getBean(ServerProperties.class);
EasyRetryProperties easyRetryProperties = SpringContext.getBean(EasyRetryProperties.class);
ServerProperties serverProperties = SpringContext.getBean(ServerProperties.class);
Integer port = easyRetryProperties.getPort();
// 获取客户端指定的端口
@ -156,8 +156,8 @@ public class NettyChannel {
FullHttpRequest request = new DefaultFullHttpRequest(
HttpVersion.HTTP_1_1, method, url, Unpooled.wrappedBuffer(body.getBytes(StandardCharsets.UTF_8)));
ServerProperties serverProperties = SpringContext.CONTEXT.getBean(ServerProperties.class);
EasyRetryProperties easyRetryProperties = SpringContext.CONTEXT.getBean(EasyRetryProperties.class);
ServerProperties serverProperties = SpringContext.getBean(ServerProperties.class);
EasyRetryProperties easyRetryProperties = SpringContext.getBean(EasyRetryProperties.class);
// server配置不能为空
EasyRetryProperties.ServerConfig serverConfig = easyRetryProperties.getServer();

View File

@ -67,7 +67,7 @@ public class NettyHttpClientHandler extends SimpleChannelInboundHandler<FullHttp
ctx.channel().eventLoop().schedule(() -> {
try {
// 抛出重连事件
SpringContext.CONTEXT.publishEvent(new ChannelReconnectEvent());
SpringContext.getContext().publishEvent(new ChannelReconnectEvent());
nettyHttpConnectClient.reconnect();
} catch (Exception e) {
EasyRetryLog.LOCAL.error("reconnect error ", e);

View File

@ -112,7 +112,7 @@ public class ReportListener implements Listener<RetryTaskDTO> {
return;
}
EasyRetryProperties properties = SpringContext.CONTEXT.getBean(EasyRetryProperties.class);
EasyRetryProperties properties = SpringContext.getBean(EasyRetryProperties.class);
AlarmContext context = AlarmContext.build()
.text(reportErrorTextMessageFormatter,
EnvironmentUtils.getActiveProfile(),