Replies: 2 comments
-
There are many different ways to make a call between different services in a spring project.But two common styles of Microservices Communications:
Synchronous CommunicationIn the case of Synchronous Communication, the client sends a request and waits for a response from the service. The important point here is that the protocol (HTTP/HTTPS) is synchronous and the client code can only continue its task when it receives the HTTP server response. For example, Microservice1 acts as a client that sends a request and waits for a response from Microservice2. We can use RestTemplate or WebClient or Spring Cloud Open Feign library to make a Synchronous Communication multiple microservices. Asynchronous CommunicationIn the case of Asynchronous Communication, The client sends a request and does not wait for a response from the service. The client will continue executing its task - It doesn’t wait for the response from the service. **I have a example with RestTemplate here: ** |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Discuss about the best practice when call between multi services in a spring boot microservices
Beta Was this translation helpful? Give feedback.
All reactions