Microservices communications
In this book, we covered two approaches for microservices to communicate with each other:
- The first approach was via RESTful APIs, where a web HTTP layer would be built into a microservice, effectively allowing the microservice to communicate with any web client, whether the web client is another microservice or a web browser. One advantage to this approach is that it empowers microservices to communicate with the outside world when needed, since HTTP is now a universal protocol that is supported by all software stacks out there. The disadvantage of this approach, however, is the fact that HTTP can be a heavy protocol with multiple layers, which may not be the best choice when the requirement is fast efficient communications between internal microservices.
- The second approach is via message queues, where a message broker software such as RabbitMQ or Kafka will facilitate the exchange of messages between microservices. Message brokers receive messages from sending...