feat: 2.1.0
1. 优化javax校验器 2. 修复JacksonSerializerNPE问题
This commit is contained in:
parent
5380104724
commit
52f3785b52
@ -1,14 +1,17 @@
|
||||
package com.aizuda.easy.retry.client.core.serializer;
|
||||
|
||||
import com.aizuda.easy.retry.client.core.RetryArgSerializer;
|
||||
import com.aizuda.easy.retry.common.core.log.LogUtils;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.aizuda.easy.retry.common.core.util.JsonUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Jackson序列化
|
||||
@ -17,6 +20,7 @@ import java.lang.reflect.Type;
|
||||
* @date : 2022-03-07 15:08
|
||||
*/
|
||||
@Component("easyRetryJacksonSerializer")
|
||||
@Slf4j
|
||||
public class JacksonSerializer implements RetryArgSerializer {
|
||||
|
||||
@Override
|
||||
@ -33,8 +37,16 @@ public class JacksonSerializer implements RetryArgSerializer {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JsonNode jsonNode = JsonUtil.toJson(infoStr);
|
||||
if (Objects.isNull(jsonNode)) {
|
||||
LogUtils.warn(log, "jsonNode is null. infoStr:[{}]", infoStr);
|
||||
return params;
|
||||
}
|
||||
|
||||
for (int i = 0; i < paramTypes.length; i++) {
|
||||
params[i] = mapper.readValue(jsonNode.get(i).toString(), mapper.constructType(paramTypes[i]));
|
||||
JsonNode node = jsonNode.get(i);
|
||||
if (Objects.nonNull(node)) {
|
||||
params[i] = mapper.readValue(node.toString(), mapper.constructType(paramTypes[i]));
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.aizuda.easy.retry.client.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.aizuda.easy.retry.client.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 生成idempotentId模型
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.aizuda.easy.retry.client.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 服务端调度重试入参
|
||||
@ -21,7 +23,7 @@ public class RetryCallbackDTO {
|
||||
private String idempotentId;
|
||||
@NotBlank(message = "executorName 不能为空")
|
||||
private String executorName;
|
||||
@NotBlank(message = "retryStatus 不能为空")
|
||||
@NotNull(message = "retryStatus 不能为空")
|
||||
private Integer retryStatus;
|
||||
@NotBlank(message = "uniqueId 不能为空")
|
||||
private String uniqueId;
|
||||
|
@ -115,12 +115,6 @@ public class ExecCallbackUnitActor extends AbstractActor {
|
||||
retryCallbackDTO.setExecutorName(retryTask.getExecutorName());
|
||||
retryCallbackDTO.setUniqueId(retryTask.getUniqueId());
|
||||
|
||||
// HttpEntity<RetryCallbackDTO> requestEntity = new HttpEntity<>(retryCallbackDTO);
|
||||
//
|
||||
// String format = MessageFormat.format(URL, serverNode.getHostIp(), serverNode.getHostPort().toString(), serverNode.getContextPath());
|
||||
// Result result = restTemplate.postForObject(format, requestEntity, Result.class);
|
||||
|
||||
|
||||
RpcClient rpcClient = RequestBuilder.<RpcClient, Result>newBuilder()
|
||||
.hostPort(serverNode.getHostPort())
|
||||
.groupName(serverNode.getGroupName())
|
||||
|
Loading…
Reference in New Issue
Block a user