I am developing microservices using Spring cloud platform where service1 calls multiple other micro services e.g. service2, service3, service 4 etc. These services can be called in parallel and service1 will aggregate the result. Can I use Spring cloud feign (http://cloud.spring.io/spring-cloud-static/Dalston.SR1/#spring-cloud-feign) to generate rest client and call the services asynchronously or Should I use Spring 4 AsyncRestTemplate to call the services asynchronously?
Asked
Active
Viewed 2.1k times
17
-
1Did you ever figure out if this is possible – mad_fox Aug 30 '17 at 15:17
-
4Use EnableAsync to enable async. The method that calls Rest service using feign should be annotated with @Async. Use CountDownLatch to check whether all the calls are done or not – Debopam Aug 30 '17 at 17:23
1 Answers
5
I have used CompletableFuture to chain async calls to mutiple micro services using feign client however was not eventually successful. Please go through below link for further information. What I understood is - Feign's is not designed for asynchronous invocation or zero-copy i/o.

Rajesh Yerur
- 51
- 1
- 2
-
-
I think you should go with WebClient.Builder from spring webflux for async call – Yogesh Katkar May 16 '21 at 07:49