you can use below solution :
Microservice A (i.e UAA-SERVICE), and Microservice B
Microservice B want to connect microservice A and call services with Feign client.
1)This code for Microservice B
Client proxy :- @AuthorizedFeignClient(name = "UAA-SERVICE")
@AuthorizedFeignClient(name = "UAA-SERVICE")
public interface UaaServiceClient {
@RequestMapping(method = RequestMethod.GET, path = "api/users")
public List<UserDTO> getUserList();
@RequestMapping(method = RequestMethod.PUT, path = "api/user-info")
public String updateUserInfo(@RequestBody UserDTO userDTO);
}
UAA-SERVICE : find this name with running Application Instances with registry.
2) In Microservice B (application.yml)
Increase feign client connection Time Out:
feign:
client:
config:
default:
connectTimeout: 10000
readTimeout: 50000
Increase hystrix Thread time out:-
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 60000
shareSecurityContext: true
3) add @EnableFeignClients in main @SpringBootApplication class.
This solution is working fine for me.