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