feat: 1.1.0
1. 优化类名 2. 更换logo
This commit is contained in:
parent
ce4163ceb0
commit
7bf0eed6b6
Binary file not shown.
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.2 KiB |
@ -2,7 +2,7 @@ package com.aizuda.easy.retry.client.core.cache;
|
||||
|
||||
import com.aizuda.easy.retry.client.core.client.request.ConfigHttpRequestHandler;
|
||||
import com.aizuda.easy.retry.client.core.client.request.RequestParam;
|
||||
import com.aizuda.easy.retry.client.core.client.response.XRetryResponse;
|
||||
import com.aizuda.easy.retry.client.core.client.response.EasyRetryResponse;
|
||||
import com.aizuda.easy.retry.client.core.Lifecycle;
|
||||
import com.aizuda.easy.retry.client.core.client.NettyHttpConnectClient;
|
||||
import com.aizuda.easy.retry.common.core.context.SpringContext;
|
||||
@ -63,7 +63,7 @@ public class GroupVersionCache implements Lifecycle {
|
||||
XRetryRequest xRetryRequest = new XRetryRequest(getVersion());
|
||||
|
||||
ConfigHttpRequestHandler configHttpRequestHandler = SpringContext.getBeanByType(ConfigHttpRequestHandler.class);
|
||||
XRetryResponse.cache(xRetryRequest, configHttpRequestHandler.callable());
|
||||
EasyRetryResponse.cache(xRetryRequest, configHttpRequestHandler.callable());
|
||||
NettyHttpConnectClient.send(configHttpRequestHandler.method(), configHttpRequestHandler.getHttpUrl(
|
||||
new RequestParam()), configHttpRequestHandler.body(xRetryRequest));
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.aizuda.easy.retry.client.core.client;
|
||||
|
||||
import com.aizuda.easy.retry.client.core.client.request.BeatHttpRequestHandler;
|
||||
import com.aizuda.easy.retry.client.core.client.response.XRetryResponse;
|
||||
import com.aizuda.easy.retry.client.core.config.XRetryProperties;
|
||||
import com.aizuda.easy.retry.client.core.client.response.EasyRetryResponse;
|
||||
import com.aizuda.easy.retry.client.core.config.EasyRetryProperties;
|
||||
import com.aizuda.easy.retry.client.core.client.request.RequestParam;
|
||||
import com.aizuda.easy.retry.common.core.context.SpringContext;
|
||||
import com.aizuda.easy.retry.common.core.log.LogUtils;
|
||||
@ -45,7 +45,7 @@ public class NettyHttpClientHandler extends SimpleChannelInboundHandler<FullHttp
|
||||
|
||||
LogUtils.info(log, "接收服务端返回数据content:[{}],headers:[{}]", content, headers);
|
||||
NettyResult nettyResult = JsonUtil.parseObject(content, NettyResult.class);
|
||||
XRetryResponse.invoke(nettyResult.getRequestId(), nettyResult);
|
||||
EasyRetryResponse.invoke(nettyResult.getRequestId(), nettyResult);
|
||||
|
||||
}
|
||||
|
||||
@ -60,8 +60,8 @@ public class NettyHttpClientHandler extends SimpleChannelInboundHandler<FullHttp
|
||||
super.channelUnregistered(ctx);
|
||||
LogUtils.debug(log, "channelUnregistered");
|
||||
ctx.channel().eventLoop().schedule(() -> {
|
||||
XRetryProperties xRetryProperties = SpringContext.getBeanByType(XRetryProperties.class);
|
||||
XRetryProperties.ServerConfig server = xRetryProperties.getServer();
|
||||
EasyRetryProperties easyRetryProperties = SpringContext.getBeanByType(EasyRetryProperties.class);
|
||||
EasyRetryProperties.ServerConfig server = easyRetryProperties.getServer();
|
||||
LogUtils.info(log, "Reconnecting to:" + server.getHost() + ":" + server.getPort());
|
||||
NettyHttpConnectClient.connect();
|
||||
}, 10, TimeUnit.SECONDS);
|
||||
@ -107,7 +107,7 @@ public class NettyHttpClientHandler extends SimpleChannelInboundHandler<FullHttp
|
||||
XRetryRequest xRetryRequest = new XRetryRequest("PING");
|
||||
|
||||
BeatHttpRequestHandler requestHandler = SpringContext.getBeanByType(BeatHttpRequestHandler.class);
|
||||
XRetryResponse.cache(xRetryRequest, requestHandler.callable());
|
||||
EasyRetryResponse.cache(xRetryRequest, requestHandler.callable());
|
||||
|
||||
NettyHttpConnectClient.send(requestHandler.method(), requestHandler.getHttpUrl(new RequestParam()), requestHandler.body(xRetryRequest)); // beat N, close if fail(may throw error)
|
||||
} else {
|
||||
|
@ -2,7 +2,7 @@ package com.aizuda.easy.retry.client.core.client;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.aizuda.easy.retry.client.core.cache.GroupVersionCache;
|
||||
import com.aizuda.easy.retry.client.core.config.XRetryProperties;
|
||||
import com.aizuda.easy.retry.client.core.config.EasyRetryProperties;
|
||||
import com.aizuda.easy.retry.client.core.Lifecycle;
|
||||
import com.aizuda.easy.retry.common.core.context.SpringContext;
|
||||
import com.aizuda.easy.retry.common.core.enums.HeadersEnum;
|
||||
@ -50,9 +50,9 @@ public class NettyHttpConnectClient implements Lifecycle, ApplicationContextAwar
|
||||
public void start() {
|
||||
|
||||
try {
|
||||
XRetryProperties xRetryProperties = applicationContext.getBean(XRetryProperties.class);
|
||||
EasyRetryProperties easyRetryProperties = applicationContext.getBean(EasyRetryProperties.class);
|
||||
|
||||
XRetryProperties.ServerConfig server = xRetryProperties.getServer();
|
||||
EasyRetryProperties.ServerConfig server = easyRetryProperties.getServer();
|
||||
final NettyHttpConnectClient thisClient = this;
|
||||
bootstrap.group(nioEventLoopGroup)
|
||||
.channel(NioSocketChannel.class)
|
||||
@ -111,7 +111,7 @@ public class NettyHttpConnectClient implements Lifecycle, ApplicationContextAwar
|
||||
.set(HttpHeaderNames.CONTENT_LENGTH, request.content().readableBytes())
|
||||
.set(HeadersEnum.HOST_ID.getKey(), HOST_ID)
|
||||
.set(HeadersEnum.HOST_IP.getKey(), HOST_IP)
|
||||
.set(HeadersEnum.GROUP_NAME.getKey(), XRetryProperties.getGroup())
|
||||
.set(HeadersEnum.GROUP_NAME.getKey(), EasyRetryProperties.getGroup())
|
||||
.set(HeadersEnum.CONTEXT_PATH.getKey(), Optional.ofNullable(serverProperties.getServlet().getContextPath()).orElse("/"))
|
||||
.set(HeadersEnum.HOST_PORT.getKey(), Optional.ofNullable(serverProperties.getPort()).orElse(8080))
|
||||
.set(HeadersEnum.VERSION.getKey(), GroupVersionCache.getVersion())
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.aizuda.easy.retry.client.core.client.request;
|
||||
|
||||
import com.aizuda.easy.retry.client.core.config.XRetryProperties;
|
||||
import com.aizuda.easy.retry.client.core.config.EasyRetryProperties;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -14,6 +14,6 @@ public class RequestParam {
|
||||
private String groupName;
|
||||
|
||||
public String getGroupName() {
|
||||
return XRetryProperties.getGroup();
|
||||
return EasyRetryProperties.getGroup();
|
||||
}
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ import java.util.function.Consumer;
|
||||
* @since 2.0
|
||||
*/
|
||||
@Slf4j
|
||||
public class XRetryResponse {
|
||||
public class EasyRetryResponse {
|
||||
|
||||
private static final ConcurrentMap<String, Consumer<NettyResult>> responsePool = new ConcurrentHashMap<>();
|
||||
|
||||
public XRetryResponse(XRetryRequest retryRequest, Consumer<NettyResult> callable) {
|
||||
public EasyRetryResponse(XRetryRequest retryRequest, Consumer<NettyResult> callable) {
|
||||
responsePool.put(retryRequest.getRequestId(), callable);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import java.util.Objects;
|
||||
@ConfigurationProperties(prefix = "easy-retry")
|
||||
@Getter
|
||||
@Setter
|
||||
public class XRetryProperties {
|
||||
public class EasyRetryProperties {
|
||||
|
||||
/**
|
||||
* 服务端对应的group
|
||||
@ -43,7 +43,7 @@ public class XRetryProperties {
|
||||
}
|
||||
|
||||
public static String getGroup() {
|
||||
XRetryProperties properties = SpringContext.applicationContext.getBean(XRetryProperties.class);
|
||||
EasyRetryProperties properties = SpringContext.applicationContext.getBean(EasyRetryProperties.class);
|
||||
return Objects.requireNonNull(properties).group;
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ package com.aizuda.easy.retry.client.core.event;
|
||||
* @author: www.byteblogs.com
|
||||
* @date : 2022-03-03 15:50
|
||||
*/
|
||||
public interface XRetryListener {
|
||||
public interface EasyRetryListener {
|
||||
void beforeRetry(String sceneName, String executorClassName, Object[] params);
|
||||
void successOnRetry(Object result, String sceneName, String executorClassName);
|
||||
void failureOnRetry(String sceneName, String executorClassName, Throwable e);
|
@ -10,7 +10,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SimpleXRetryListener implements XRetryListener {
|
||||
public class SimpleEasyRetryListener implements EasyRetryListener {
|
||||
|
||||
@Override
|
||||
public void beforeRetry(String sceneName, String executorClassName, Object[] params) {
|
@ -2,7 +2,7 @@ package com.aizuda.easy.retry.client.core.intercepter;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.easy.retry.client.core.cache.GroupVersionCache;
|
||||
import com.aizuda.easy.retry.client.core.config.XRetryProperties;
|
||||
import com.aizuda.easy.retry.client.core.config.EasyRetryProperties;
|
||||
import com.aizuda.easy.retry.client.core.exception.EasyRetryClientException;
|
||||
import com.aizuda.easy.retry.client.core.strategy.RetryStrategy;
|
||||
import com.aizuda.easy.retry.client.core.annotation.Retryable;
|
||||
@ -157,10 +157,10 @@ public class RetryAspect implements Ordered {
|
||||
AlarmContext context = AlarmContext.build()
|
||||
.text(retryErrorMoreThresholdTextMessageFormatter,
|
||||
EnvironmentUtils.getActiveProfile(),
|
||||
XRetryProperties.getGroup(),
|
||||
EasyRetryProperties.getGroup(),
|
||||
LocalDateTime.now().format(formatter),
|
||||
e.getMessage())
|
||||
.title("重试组件异常:[{}]", XRetryProperties.getGroup())
|
||||
.title("重试组件异常:[{}]", EasyRetryProperties.getGroup())
|
||||
.notifyAttribute(notifyAttribute.getNotifyAttribute());
|
||||
|
||||
Alarm<AlarmContext> alarmType = altinAlarmFactory.getAlarmType(notifyAttribute.getNotifyType());
|
||||
|
@ -2,7 +2,7 @@ package com.aizuda.easy.retry.client.core.report;
|
||||
|
||||
import com.aizuda.easy.retry.client.core.BizIdGenerate;
|
||||
import com.aizuda.easy.retry.client.core.RetryArgSerializer;
|
||||
import com.aizuda.easy.retry.client.core.config.XRetryProperties;
|
||||
import com.aizuda.easy.retry.client.core.config.EasyRetryProperties;
|
||||
import com.aizuda.easy.retry.client.core.Lifecycle;
|
||||
import com.aizuda.easy.retry.client.core.cache.RetryerInfoCache;
|
||||
import com.aizuda.easy.retry.client.core.exception.EasyRetryClientException;
|
||||
@ -76,7 +76,7 @@ public class ReportHandler implements Lifecycle {
|
||||
retryTaskDTO.setBizId(bizId);
|
||||
retryTaskDTO.setExecutorName(targetClassName);
|
||||
retryTaskDTO.setArgsStr(serialize);
|
||||
retryTaskDTO.setGroupName(XRetryProperties.getGroup());
|
||||
retryTaskDTO.setGroupName(EasyRetryProperties.getGroup());
|
||||
retryTaskDTO.setSceneName(scene);
|
||||
|
||||
String bizNoSpel = retryerInfo.getBizNo();
|
||||
|
@ -2,8 +2,8 @@ package com.aizuda.easy.retry.client.core.report;
|
||||
|
||||
import com.aizuda.easy.retry.client.core.RetryExecutor;
|
||||
import com.aizuda.easy.retry.client.core.RetryExecutorParameter;
|
||||
import com.aizuda.easy.retry.client.core.client.response.XRetryResponse;
|
||||
import com.aizuda.easy.retry.client.core.config.XRetryProperties;
|
||||
import com.aizuda.easy.retry.client.core.client.response.EasyRetryResponse;
|
||||
import com.aizuda.easy.retry.client.core.config.EasyRetryProperties;
|
||||
import com.github.rholder.retry.*;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.aizuda.easy.retry.client.core.cache.GroupVersionCache;
|
||||
@ -59,7 +59,7 @@ public class ReportListener implements Listener<RetryTaskDTO> {
|
||||
|
||||
XRetryRequest xRetryRequest = new XRetryRequest(list);
|
||||
ReportRetryInfoHttpRequestHandler requestHandler = SpringContext.getBeanByType(ReportRetryInfoHttpRequestHandler.class);
|
||||
XRetryResponse.cache(xRetryRequest, requestHandler.callable());
|
||||
EasyRetryResponse.cache(xRetryRequest, requestHandler.callable());
|
||||
NettyHttpConnectClient.send(requestHandler.method(), requestHandler.getHttpUrl(new RequestParam()), requestHandler.body(xRetryRequest));
|
||||
|
||||
return null;
|
||||
@ -118,10 +118,10 @@ public class ReportListener implements Listener<RetryTaskDTO> {
|
||||
AlarmContext context = AlarmContext.build()
|
||||
.text(reportErrorTextMessageFormatter,
|
||||
EnvironmentUtils.getActiveProfile(),
|
||||
XRetryProperties.getGroup(),
|
||||
EasyRetryProperties.getGroup(),
|
||||
LocalDateTime.now().format(formatter),
|
||||
e.getMessage())
|
||||
.title("上报异常:[{}]", XRetryProperties.getGroup())
|
||||
.title("上报异常:[{}]", EasyRetryProperties.getGroup())
|
||||
.notifyAttribute(notifyAttribute.getNotifyAttribute());
|
||||
|
||||
AltinAlarmFactory altinAlarmFactory = SpringContext.getBeanByType(AltinAlarmFactory.class);
|
||||
|
@ -2,7 +2,7 @@ package com.aizuda.easy.retry.client.core.strategy;
|
||||
|
||||
import com.aizuda.easy.retry.client.core.RetryExecutor;
|
||||
import com.aizuda.easy.retry.client.core.RetryExecutorParameter;
|
||||
import com.aizuda.easy.retry.client.core.event.XRetryListener;
|
||||
import com.aizuda.easy.retry.client.core.event.EasyRetryListener;
|
||||
import com.aizuda.easy.retry.client.core.intercepter.RetrySiteSnapshot;
|
||||
import com.github.rholder.retry.Retryer;
|
||||
import com.github.rholder.retry.StopStrategy;
|
||||
@ -27,7 +27,7 @@ import java.util.function.Consumer;
|
||||
public abstract class AbstractRetryStrategies implements RetryStrategy {
|
||||
|
||||
@Autowired
|
||||
private List<XRetryListener> XRetryListeners;
|
||||
private List<EasyRetryListener> EasyRetryListeners;
|
||||
|
||||
@Override
|
||||
public RetryerResultContext openRetry(String sceneName, String executorClassName, Object[] params) {
|
||||
@ -52,8 +52,8 @@ public abstract class AbstractRetryStrategies implements RetryStrategy {
|
||||
retryerResultContext.setRetryerInfo(retryerInfo);
|
||||
|
||||
try {
|
||||
for (XRetryListener XRetryListener : XRetryListeners) {
|
||||
XRetryListener.beforeRetry(sceneName, executorClassName, params);
|
||||
for (EasyRetryListener EasyRetryListener : EasyRetryListeners) {
|
||||
EasyRetryListener.beforeRetry(sceneName, executorClassName, params);
|
||||
}
|
||||
|
||||
Object result = retryExecutor.call(retryer, doGetCallable(retryExecutor, params), getRetryErrorConsumer(retryerResultContext, params), getRetrySuccessConsumer(retryerResultContext));
|
||||
@ -79,8 +79,8 @@ public abstract class AbstractRetryStrategies implements RetryStrategy {
|
||||
Object result = retryerResultContext.getResult();
|
||||
RetryerInfo retryerInfo = retryerResultContext.getRetryerInfo();
|
||||
|
||||
for (XRetryListener XRetryListener : XRetryListeners) {
|
||||
XRetryListener.successOnRetry(result, retryerInfo.getScene(), retryerInfo.getExecutorClassName());
|
||||
for (EasyRetryListener EasyRetryListener : EasyRetryListeners) {
|
||||
EasyRetryListener.successOnRetry(result, retryerInfo.getScene(), retryerInfo.getExecutorClassName());
|
||||
}
|
||||
|
||||
doRetrySuccessConsumer(retryerResultContext).accept(retryerResultContext);
|
||||
@ -99,8 +99,9 @@ public abstract class AbstractRetryStrategies implements RetryStrategy {
|
||||
|
||||
RetryerInfo retryerInfo = context.getRetryerInfo();
|
||||
try {
|
||||
for (XRetryListener XRetryListener : XRetryListeners) {
|
||||
XRetryListener.failureOnRetry(retryerInfo.getScene(), retryerInfo.getExecutorClassName(), throwable);
|
||||
for (EasyRetryListener EasyRetryListener : EasyRetryListeners) {
|
||||
EasyRetryListener
|
||||
.failureOnRetry(retryerInfo.getScene(), retryerInfo.getExecutorClassName(), throwable);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("失败监听者模式 处理失败 ", e);
|
||||
|
BIN
frontend/public/logo.png
vendored
BIN
frontend/public/logo.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 8.2 KiB |
Loading…
Reference in New Issue
Block a user