retry机制抛出异常
This commit is contained in:
@@ -18,7 +18,6 @@ public interface DiFyFeign {
|
||||
, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
JSONObject runWorkflows(@RequestHeader(value = "Authorization") String authorization, @RequestBody Map<String, Object> map);
|
||||
|
||||
@Retryable(maxAttempts = 1, backoff = @Backoff(delay = 1000))
|
||||
@PostMapping(value = "v1/workflows/run"
|
||||
, consumes = MediaType.APPLICATION_JSON_VALUE
|
||||
, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@@ -79,6 +79,9 @@ public class ClaimVerificationServiceImpl implements ClaimVerificationService {
|
||||
@Autowired
|
||||
private AiAnalysisErrorsMapper aiAnalysisErrorsMapper;
|
||||
|
||||
@Autowired
|
||||
private DiFyRetryImpl diFyRetry;
|
||||
|
||||
@Override
|
||||
public void consumerMessageByMQ(String message) {
|
||||
// 生成ai分析请求id
|
||||
@@ -162,8 +165,8 @@ public class ClaimVerificationServiceImpl implements ClaimVerificationService {
|
||||
diFyReq.setUser(BusinessTypeEnum.CLAIM_VERIFICATION.getCode());
|
||||
diFyReq.setFlowId(verificationToken);
|
||||
diFyReq.setInputs(parsedAudit);
|
||||
//调用dify 工作流
|
||||
diFyObject = (JSONObject) diFyService.getDiFyObjectRetry(diFyReq);
|
||||
//调用dify 工作流 失败重试一次
|
||||
diFyObject = diFyRetry.getDiFyRetry(diFyReq);
|
||||
//处理结果并推送MQ
|
||||
if (diFyObject == null) {
|
||||
log.error("售后索赔检核审计报告dify返回结果为空");
|
||||
@@ -187,7 +190,6 @@ public class ClaimVerificationServiceImpl implements ClaimVerificationService {
|
||||
sendErrorCallBack(claimVerificationFileAnalysisDTO, aiAnalysisRequestId);
|
||||
//保存错误日志
|
||||
saveException(e.getMessage(), aiAnalysisRequestId, diFyObject);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.volvo.ai.analytic.center.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.volvo.ai.analytic.center.dto.req.DiFyReq;
|
||||
import com.volvo.ai.analytic.center.service.DiFyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* dify调用retry
|
||||
*/
|
||||
@Service
|
||||
public class DiFyRetryImpl {
|
||||
|
||||
@Autowired
|
||||
private DiFyService diFyService;
|
||||
public JSONObject getDiFyRetry(DiFyReq diFyReq) {
|
||||
|
||||
return (JSONObject) diFyService.getDiFyObjectRetry(diFyReq);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user