feat: 3.2.0

1. 重试接入实时日志
This commit is contained in:
byteblogs168 2024-03-17 22:48:32 +08:00
parent 1aa633fbd6
commit 3f824834b5
3 changed files with 12 additions and 4 deletions

View File

@ -63,6 +63,7 @@ public class RetryEndPoint {
RetryerInfo retryerInfo = RetryerInfoCache.get(executeReqDto.getScene(), executeReqDto.getExecutorName()); RetryerInfo retryerInfo = RetryerInfoCache.get(executeReqDto.getScene(), executeReqDto.getExecutorName());
if (Objects.isNull(retryerInfo)) { if (Objects.isNull(retryerInfo)) {
EasyRetryLog.REMOTE.error("场景:[{}]配置不存在, 请检查您的场景和执行器是否存在", executeReqDto.getScene());
throw new EasyRetryClientException("场景:[{}]配置不存在, 请检查您的场景和执行器是否存在", executeReqDto.getScene()); throw new EasyRetryClientException("场景:[{}]配置不存在, 请检查您的场景和执行器是否存在", executeReqDto.getScene());
} }
@ -73,6 +74,7 @@ public class RetryEndPoint {
deSerialize = (Object[]) retryArgSerializer.deSerialize(executeReqDto.getArgsStr(), deSerialize = (Object[]) retryArgSerializer.deSerialize(executeReqDto.getArgsStr(),
retryerInfo.getExecutor().getClass(), retryerInfo.getMethod()); retryerInfo.getExecutor().getClass(), retryerInfo.getMethod());
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
EasyRetryLog.REMOTE.error("参数解析异常", e);
throw new EasyRetryClientException("参数解析异常", e); throw new EasyRetryClientException("参数解析异常", e);
} }
@ -86,8 +88,6 @@ public class RetryEndPoint {
if (RetrySiteSnapshot.isRetryForStatusCode()) { if (RetrySiteSnapshot.isRetryForStatusCode()) {
executeRespDto.setStatusCode(RetryResultStatusEnum.STOP.getStatus()); executeRespDto.setStatusCode(RetryResultStatusEnum.STOP.getStatus());
// TODO 需要标记是哪个系统不需要重试
executeRespDto.setExceptionMsg("下游标记不需要重试"); executeRespDto.setExceptionMsg("下游标记不需要重试");
} else { } else {
executeRespDto.setStatusCode(retryerResultContext.getRetryResultStatusEnum().getStatus()); executeRespDto.setStatusCode(retryerResultContext.getRetryResultStatusEnum().getStatus());
@ -100,6 +100,14 @@ public class RetryEndPoint {
executeRespDto.setResultJson(JsonUtil.toJsonString(retryerResultContext.getResult())); executeRespDto.setResultJson(JsonUtil.toJsonString(retryerResultContext.getResult()));
} }
if (Objects.equals(RetryResultStatusEnum.SUCCESS.getStatus(), executeRespDto.getStatusCode())) {
EasyRetryLog.REMOTE.info("remote retry complete. count:[{}] result:[{}]", executeReqDto.getRetryCount(), executeRespDto.getResultJson());
} if (Objects.equals(RetryResultStatusEnum.STOP.getStatus(), executeRespDto.getStatusCode())) {
EasyRetryLog.REMOTE.info("remote retry complete. count:[{}] exceptionMsg:[{}]", executeReqDto.getRetryCount(), executeRespDto.getExceptionMsg());
} else {
EasyRetryLog.REMOTE.info("remote retry complete. count:[{}] ", executeReqDto.getRetryCount(), retryerResultContext.getThrowable());
}
} finally { } finally {
RetrySiteSnapshot.removeAll(); RetrySiteSnapshot.removeAll();
} }

View File

@ -185,7 +185,7 @@ public class EasyRetryInterceptor implements MethodInterceptor, AfterAdvice, Ser
if (RetryResultStatusEnum.SUCCESS.getStatus().equals(context.getRetryResultStatusEnum().getStatus())) { if (RetryResultStatusEnum.SUCCESS.getStatus().equals(context.getRetryResultStatusEnum().getStatus())) {
EasyRetryLog.LOCAL.debug("local retry successful. traceId:[{}] result:[{}]", traceId, context.getResult()); EasyRetryLog.LOCAL.debug("local retry successful. traceId:[{}] result:[{}]", traceId, context.getResult());
} else { } else {
EasyRetryLog.LOCAL.info("local retry result. traceId:[{}] throwable:[{}]", traceId, context.getThrowable()); EasyRetryLog.LOCAL.debug("local retry result. traceId:[{}] throwable:[{}]", traceId, context.getThrowable());
} }
return context; return context;

View File

@ -1,4 +1,4 @@
package com.aizuda.easy.retry.server.starter.server.handler; package com.aizuda.easy.retry.server.job.task.support.request;
import akka.actor.ActorRef; import akka.actor.ActorRef;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;