Logo InterviewVault

Welcome back, Sujit Kumar Mishra

SKM

Revision Mode

Document technical questions and best-practice answers.

Cancel

Asynchronous Programming in Microservices


Question:

Do you have experience with asynchronous programming?


How would you implement:

1: Synchronous communication

2: Asynchronous communication

between APIs in a Spring Boot microservices architecture?

Yes, I have experience with asynchronous programming.


In Spring Boot microservices

1: Synchronous Communication

- APIs directly call each other and wait for a response.

Example: Using RestTemplate or WebClient to make HTTP calls.

- The client waits until it gets the result before continuing.


2: Asynchronous Communication

- APIs send messages/events and do not wait for a reply.

Example: Using message brokers like RabbitMQ, Kafka, or JMS.

- The sender puts the message on a queue/topic, and the receiver processes it later.


Summary:

1: Use synchronous for quick, direct responses (HTTP calls).

2: Use asynchronous for decoupled, scalable, and non-blocking operations (messaging).

Ready for commit