retry机制抛出异常
This commit is contained in:
@@ -18,6 +18,7 @@ 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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user