There are two options when integrating applications:
- Synchronous: Service consumer invokes the service provider and waits for a response.
- Asynchronous: Service consumer invokes the service provider by putting the message on the message broker but does not wait for the response.
The services that we built with Spring Boot in Chapter 5, Building Microservices with Spring Boot, (random service, add service) are examples of synchronous integration. These are typical web services that are exposed over HTTP. The service consumer calls the service and waits for a response. The next call is made only on the completion of the previous service call.
One important disadvantage of this approach is the expectation that the service provider is always available. The service consumer will need to re-execute the service again if the service provider is...