1

I have made POST call with feignClient with "XYZ" object request message, then I didn't get response within "5" seconds (This is expected), so I sent "ERROR" object request to the same service but I didn't get any response and causing below 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

Code:

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
Pand005
  • 1,095
  • 3
  • 23
  • 53

0 Answers0