feat: 2.6.0
1. 优化回调日志 2. 隐藏任务节点工具栏
This commit is contained in:
parent
b9e98c9514
commit
c6e30e88cd
@ -79,8 +79,8 @@ public class CallbackWorkflowExecutor extends AbstractWorkflowExecutor {
|
|||||||
requestHeaders.set(RequestInterceptor.TIMEOUT_TIME, CALLBACK_TIMEOUT);
|
requestHeaders.set(RequestInterceptor.TIMEOUT_TIME, CALLBACK_TIMEOUT);
|
||||||
|
|
||||||
List<JobTask> jobTasks = jobTaskMapper.selectList(new LambdaQueryWrapper<JobTask>()
|
List<JobTask> jobTasks = jobTaskMapper.selectList(new LambdaQueryWrapper<JobTask>()
|
||||||
.select(JobTask::getResultMessage, JobTask::getClientInfo)
|
.select(JobTask::getResultMessage, JobTask::getClientInfo)
|
||||||
.eq(JobTask::getTaskBatchId, context.getTaskBatchId()));
|
.eq(JobTask::getTaskBatchId, context.getTaskBatchId()));
|
||||||
List<CallbackParamsDTO> callbackParamsList = WorkflowTaskConverter.INSTANCE.toCallbackParamsDTO(jobTasks);
|
List<CallbackParamsDTO> callbackParamsList = WorkflowTaskConverter.INSTANCE.toCallbackParamsDTO(jobTasks);
|
||||||
|
|
||||||
context.setTaskResult(JsonUtil.toJsonString(callbackParamsList));
|
context.setTaskResult(JsonUtil.toJsonString(callbackParamsList));
|
||||||
@ -88,29 +88,16 @@ public class CallbackWorkflowExecutor extends AbstractWorkflowExecutor {
|
|||||||
try {
|
try {
|
||||||
Map<String, String> uriVariables = new HashMap<>();
|
Map<String, String> uriVariables = new HashMap<>();
|
||||||
uriVariables.put(SECRET, decisionConfig.getSecret());
|
uriVariables.put(SECRET, decisionConfig.getSecret());
|
||||||
Retryer<ResponseEntity<String>> retryer = RetryerBuilder.<ResponseEntity<String>>newBuilder()
|
|
||||||
.retryIfException(throwable -> true)
|
|
||||||
.withWaitStrategy(WaitStrategies.fixedWait(150, TimeUnit.MILLISECONDS))
|
|
||||||
.withStopStrategy(StopStrategies.stopAfterAttempt(10))
|
|
||||||
.withRetryListener(new RetryListener() {
|
|
||||||
@Override
|
|
||||||
public <V> void onRetry(final Attempt<V> attempt) {
|
|
||||||
if (attempt.hasException()) {
|
|
||||||
EasyRetryLog.LOCAL.error("回调接口第 【{}】 重试. 回调配置信息: [{}]",
|
|
||||||
attempt.getAttemptNumber(), JsonUtil.toJsonString(decisionConfig));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).build();
|
|
||||||
|
|
||||||
ResponseEntity<String> response = retryer.call(
|
ResponseEntity<String> response = buildRetryer(decisionConfig).call(
|
||||||
() -> restTemplate.exchange(decisionConfig.getWebhook(), HttpMethod.POST,
|
() -> restTemplate.exchange(decisionConfig.getWebhook(), HttpMethod.POST,
|
||||||
new HttpEntity<>(callbackParamsList, requestHeaders), String.class, uriVariables));
|
new HttpEntity<>(callbackParamsList, requestHeaders), String.class, uriVariables));
|
||||||
|
|
||||||
result = response.getBody();
|
result = response.getBody();
|
||||||
EasyRetryLog.LOCAL.info("回调结果. webHook:[{}],结果: [{}]", decisionConfig.getWebhook(), result);
|
EasyRetryLog.LOCAL.info("回调结果. webHook:[{}],结果: [{}]", decisionConfig.getWebhook(), result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
EasyRetryLog.LOCAL.error("回调异常. webHook:[{}],参数: [{}]", decisionConfig.getWebhook(),
|
EasyRetryLog.LOCAL.error("回调异常. webHook:[{}],参数: [{}]", decisionConfig.getWebhook(),
|
||||||
context.getTaskResult(), e);
|
context.getTaskResult(), e);
|
||||||
taskBatchStatus = JobTaskBatchStatusEnum.FAIL.getStatus();
|
taskBatchStatus = JobTaskBatchStatusEnum.FAIL.getStatus();
|
||||||
operationReason = JobOperationReasonEnum.WORKFLOW_CALLBACK_NODE_EXECUTOR_ERROR.getReason();
|
operationReason = JobOperationReasonEnum.WORKFLOW_CALLBACK_NODE_EXECUTOR_ERROR.getReason();
|
||||||
jobTaskStatus = JobTaskStatusEnum.FAIL.getStatus();
|
jobTaskStatus = JobTaskStatusEnum.FAIL.getStatus();
|
||||||
@ -135,6 +122,23 @@ public class CallbackWorkflowExecutor extends AbstractWorkflowExecutor {
|
|||||||
context.setLogMessage(message);
|
context.setLogMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Retryer<ResponseEntity<String>> buildRetryer(CallbackConfig decisionConfig) {
|
||||||
|
Retryer<ResponseEntity<String>> retryer = RetryerBuilder.<ResponseEntity<String>>newBuilder()
|
||||||
|
.retryIfException(throwable -> true)
|
||||||
|
.withWaitStrategy(WaitStrategies.fixedWait(150, TimeUnit.MILLISECONDS))
|
||||||
|
.withStopStrategy(StopStrategies.stopAfterAttempt(10))
|
||||||
|
.withRetryListener(new RetryListener() {
|
||||||
|
@Override
|
||||||
|
public <V> void onRetry(final Attempt<V> attempt) {
|
||||||
|
if (attempt.hasException()) {
|
||||||
|
EasyRetryLog.LOCAL.error("回调接口第 【{}】 重试. 回调配置信息: [{}]",
|
||||||
|
attempt.getAttemptNumber(), JsonUtil.toJsonString(decisionConfig));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).build();
|
||||||
|
return retryer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean doPreValidate(WorkflowExecutorContext context) {
|
protected boolean doPreValidate(WorkflowExecutorContext context) {
|
||||||
@ -154,12 +158,12 @@ public class CallbackWorkflowExecutor extends AbstractWorkflowExecutor {
|
|||||||
logMetaDTO.setJobId(SystemConstants.CALLBACK_JOB_ID);
|
logMetaDTO.setJobId(SystemConstants.CALLBACK_JOB_ID);
|
||||||
logMetaDTO.setTaskId(jobTask.getId());
|
logMetaDTO.setTaskId(jobTask.getId());
|
||||||
if (jobTaskBatch.getTaskBatchStatus() == JobTaskStatusEnum.SUCCESS.getStatus()) {
|
if (jobTaskBatch.getTaskBatchStatus() == JobTaskStatusEnum.SUCCESS.getStatus()) {
|
||||||
EasyRetryLog.REMOTE.info("workflowNodeId:[{}] 回调成功. 回调参数:[{}] 回调结果:[{}] <|>{}<|>",
|
EasyRetryLog.REMOTE.info("回调成功. \n workflowNodeId:{} \n回调参数:{} \n回调结果:[{}] <|>{}<|>",
|
||||||
context.getWorkflowNodeId(), context.getTaskResult(), context.getTaskResult(), logMetaDTO);
|
context.getWorkflowNodeId(), context.getTaskResult(), context.getEvaluationResult(), logMetaDTO);
|
||||||
} else {
|
} else {
|
||||||
EasyRetryLog.REMOTE.error("workflowNodeId:[{}] 回调失败. 失败原因:[{}] <|>{}<|>",
|
EasyRetryLog.REMOTE.error(" 回调失败.\n workflowNodeId:{} \n失败原因:{} <|>{}<|>",
|
||||||
context.getWorkflowNodeId(),
|
context.getWorkflowNodeId(),
|
||||||
context.getLogMessage(), logMetaDTO);
|
context.getLogMessage(), logMetaDTO);
|
||||||
|
|
||||||
// 尝试完成任务
|
// 尝试完成任务
|
||||||
workflowBatchHandler.complete(context.getWorkflowTaskBatchId());
|
workflowBatchHandler.complete(context.getWorkflowTaskBatchId());
|
||||||
|
21
frontend/public/lib/assets/A9pDu52i.js
Normal file
21
frontend/public/lib/assets/A9pDu52i.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -5,8 +5,8 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Easy Retry</title>
|
<title>Easy Retry</title>
|
||||||
<script type="module" crossorigin src="./assets/jjGQgzj_.js"></script>
|
<script type="module" crossorigin src="./assets/A9pDu52i.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="./assets/psiNPyrX.css">
|
<link rel="stylesheet" crossorigin href="./assets/fa4VA5HH.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
Loading…
Reference in New Issue
Block a user