I am new for Microservices and as far as I know, message brokers (RabbitMQ and Kafka) are mainly used in Microservices. However, there are some situations that we do not need to use asynchronous communication. So;
1. Could you give me some situations for when no need asynchronous communication except from some operations that does not take time?
2. If we use a message broker (RabbitMQ or Kafka) in our Microservice, then can we use both async and synch communication in this service? I think we don't have to use messaging broker for all of the communication in that service, right?
CodePudding user response:
One of the situations that happens all the time is you want to retrieve some data from multiple services at the same time. For example, you have 3 services user data, cart, billing, and products
you added your products to the cart and its time to place your order the second service is responsible but the user need to see all data so instead of doing 3 requests at the user side you can do it synchronized at the backend side by communicating with each server and grab your data