Message-based asynchronous communication

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 ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.