17

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?

Debopam
  • 3,198
  • 6
  • 41
  • 72
  • 1
    Did you ever figure out if this is possible – mad_fox Aug 30 '17 at 15:17
  • 4
    Use 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 Answers1

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.

https://github.com/OpenFeign/feign/issues/361

Rajesh Yerur
  • 51
  • 1
  • 2