3

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 ?

Amir Choubani
  • 829
  • 2
  • 14
  • 28

1 Answers1

4

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

Ravi Parekh
  • 5,253
  • 9
  • 46
  • 58