如何解决请求处理失败;嵌套异常为feign.RetryableException:执行POST读取超时
我已经用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 举报,一经查实,本站将立刻删除。