There are three common ways to make communication among services. Below are three ways to make synchronized communication. Once the client sends a request, it waits until get the response from the service.
1. WebTemplate [Deprecated soon, so skipped in this blog]
2. WebClient
3. Spring Cloud OpenFeign
2. WebClient
3. Spring Cloud OpenFeign
WebTemplete, It's gonna be deprecated soon. Therefore spring recommends using WebClient instead of it. We will see two ways (WebClient and OpenFeign) communication among microservices.
1. What is WebClient?
WebClient is part of the Spring WebFlux module and is designed for asynchronous, non-blocking HTTP requests. It is a modern replacement for the older RestTemplate and offers a more flexible and functional approach to making HTTP calls. With WebClient, you can easily perform GET, POST, PUT, DELETE, and other HTTP operations with minimal boilerplate code.
Key Features of WebClient
1. Non-Blocking
2. Fluent API
3. Error Handling
4. Support for Reactive Streams
1. Non-Blocking
2. Fluent API
3. Error Handling
4. Support for Reactive Streams
0 Comments