retry机制抛出异常

This commit is contained in:
lxu75
2025-05-21 15:57:39 +08:00
parent a231fecaa5
commit af152be1a6
2 changed files with 7 additions and 1 deletions

View File

@@ -3,19 +3,24 @@ 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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
/**
* dify调用retry
*/
@Slf4j
@Service
public class DiFyRetryImpl {
@Autowired
private DiFyService diFyService;
@Retryable(maxAttempts = 1, backoff = @Backoff(delay = 1000))
public JSONObject getDiFyRetry(DiFyReq diFyReq) {
log.info("diFyService class: {}", diFyService.getClass());
return (JSONObject) diFyService.getDiFyObjectRetry(diFyReq);
}