1

我已经使用“XYZ”对象请求消息与 feignClient 进行了 POST 调用,然后我没有在“5”秒内得到响应(这是预期的),所以我向同一个服务发送了“错误”对象请求但我没有得到任何响应并导致以下错误。

Request processing failed; nested exception is feign.RetryableException: Read timed out executing POST xyz.com/third-party/abc/1212 with root cause java.net.SocketTimeoutException: Read timed out

代码:

try {
      ResponseEntity<Object> successResponseEntity = sapService.callService(XYZ);

} catch (RetryableException e) {
        ResponseEntity<Object> errorResponseEntity = sapService.callService(ERROR);
}


// fiegn client

@FeignClient(name = "sapService", url = "${abc.url}", configuration = FeignClientInterceptorConfiguration.class)
public interface SapService {

  @PostMapping(path = "${endpoint}")
  ResponseEntity<Object> callService(@PathVariable(value = "name") String name, @RequestBody Object request);
}


public class FeignClientInterceptorConfiguration {

@Bean
  public Retryer retryer(ApplicationContext applicationContext) {
    return Retryer.NEVER_RETRY;
  }

}

应用程序.yaml

feign:
  client:
    config:
      SapService:
        readTimeout: 5000
        connectTimeout: 5000
4

0 回答 0