Reputation: 1011
Any idea please about the best way to use for back to back communication ?
spring cloud OpenFeign or WebClient/RestTemplate ?
I think Feign client should be used when spring cloud gateway need to
communicate to other microservices, whereas WebClient/RestTemplate should be used for back to back communication.
Am I wrong ?
Upvotes: 3
Views: 4664
Reputation: 629
Feign Client is a great option for APIs as it usually requires less boilerplate code, can handle fault tolerance, and is easy to configure for retry attempts and timeouts.
Upvotes: 1
Reputation: 5622
WebClient (RestTemplate - deprecated to support WebClient)
Supports reactive call
underlying HTTP client libraries such as Reactor Netty
Part of spring framework - WebFlux || Doc will give you more
Comes in 2 flavour - Annotation and functional way
Personally I found it very useful while working with OAuth2 creating bean webClient, before making call it needs to be authenticated with token, ServerOAuth2AuthorizedClientExchangeFilterFunction
will ease each call with just one time configuration
OpenFeign
Upvotes: 5