问题描述
我已经用feignClient发出了带有“ XYZ”对象请求消息的POST调用,然后我没有在“ 5”秒内得到响应(这是预期的),所以我将“ ERROR”对象请求发送到了同一服务,但是我没有任何响应并导致以下错误。
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;
}
}
Application.yaml
feign:
client:
config:
SapService:
readTimeout: 5000
connectTimeout: 5000
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)