Senior From PDF Microservices Microservices

What are synchronous and asynchronous communication in microservices?

Short answer: Synchronous Communication: In synchronous communication, one service sends a request to another service and waits for the response before continuing with its processing. The service that sends the request is blocked until it receives a response from the other service. This is typically used for real-time communication, like RESTful APIs over HTTP.

Example code

A User Service might request the Payment Service to verify a payment before processing an order. The User Service waits until it receives the response. Asynchronous Communication: In asynchronous communication, one service sends a request to another service but does not wait for a response. The requesting service continues processing while the service handling the request processes it in the background. This is typically used in event-driven architectures with message brokers. Example: An Order Service might send a message to a queue (via RabbitMQ or Kafka) about a new order, and the Inventory Service processes it at its own pace, independently of the Order Service.

Real-world example (ShopNest)

ShopNest splits Catalog, Cart, Order, and Payment into services so teams can deploy catalog changes without redeploying payments.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details