Quick revision
The short answer
Synchronous REST calls give the caller an immediate answer but tie its availability and latency to the callee's, while asynchronous messaging decouples them and smooths load at the price of eventual consistency. For order placement, the stock check, or better a stock reservation, is synchronous because the customer needs the result before we can confirm the order; notifying the warehouse is an asynchronous event published after the order is stored. The rule is to ask whether the caller needs the result to continue.
What to remember
In this answer, we saw that synchronous calls give immediate answers but couple the availability and latency of both services, while asynchronous messaging decouples them and absorbs load at the price of eventual consistency and extra machinery. For order placement, reserving stock is a synchronous step because the customer needs the result, and notifying the warehouse is an event published reliably through an outbox after the order is stored. The deciding question is always whether the caller needs the result to continue.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Synchronous REST calls give the caller an immediate answer but tie its availability and latency to the callee's, while asynchronous messaging decouples them and smooths load at the price of eventual consistency. For order placement, the stock check, or better a stock reservation, is synchronous because the customer needs the result before we can confirm the order; notifying the warehouse is an asynchronous event published after the order is stored. The rule is to ask whether the caller needs the result to continue.
Why this question is asked
Choosing between a request and a message is a decision we make at every integration point in a microservice system, and the wrong default in either direction hurts: everything synchronous makes the system fragile, everything asynchronous makes simple things complicated. Interviewers ask this with a concrete example to see whether we can reason about each step instead of reciting slogans. In this answer, we will recap how the two styles work, compare what each gives and costs, and then design the order placement flow step by step.
1A Quick Recap of the Two Styles
In a synchronous call, the caller sends a request, for example an HTTP POST with Spring's RestClient, and waits for the response before continuing. The answer is immediate and the code reads like an ordinary method call. But while it waits, the caller holds a thread and a connection, and if the callee is slow or down, the caller is slow or failing too.
In asynchronous messaging, the sender puts a message on a broker such as Kafka or RabbitMQ and moves on without waiting. The broker stores the message until a consumer processes it, whether that is milliseconds or minutes later. The sender does not need the consumer to be running at that moment; it only needs the broker.
2What Each Style Gives and Costs
The heart of the trade-off is coupling in time. With synchronous calls, both services must be up at the same moment, and their latencies add: if the order service takes 50 ms and calls an inventory service that takes 80 ms, the customer waits at least 130 ms. If inventory is down, order placement is down. With messaging, the services are decoupled in time: the warehouse system can be restarted for ten minutes and no order fails; messages simply wait.
Messaging also smooths load. During a sale, the broker absorbs a spike of 5,000 orders a minute and the warehouse consumer works through them at its own pace. The cost is eventual consistency: for some time after the order is placed, the warehouse does not know about it yet, and the system has to be designed so that this lag is acceptable. Messaging also adds moving parts: a broker to run, retries, duplicate messages and ordering to think about.
| Aspect | Synchronous REST | Asynchronous messaging |
|---|---|---|
| Answer | Immediate, in the response | Later, if at all |
| Availability | Both must be up now | Only the broker must be up |
| Latency | Adds up along the chain | Sender returns at once |
| Load spikes | Hit the callee directly | Absorbed by the broker |
| Consistency | Caller sees the result now | Eventual |
| Complexity | Simple to write and debug | Broker, retries, duplicates |
3Checking Stock Before Confirming the Order
When a customer clicks Place order, we must not confirm an order for an item we cannot supply. So the order service needs to know about stock before it answers, and that means the customer is waiting for the result. That points to a synchronous step.
But there is a catch with a plain check. If we only ask whether 1 unit is available and then confirm, two customers can both see the last unit and both get a confirmation. A better design is a reservation: the order service calls the inventory service to reserve the quantity for this order, inventory decrements its available count atomically and returns a reservation id with an expiry, for example 15 minutes. If payment fails or the order is abandoned, the reservation expires or is released.
Notice that this synchronous call needs a timeout and a clear failure behaviour, because inventory being down now blocks ordering. Some designs make even this step asynchronous by accepting the order as pending and confirming it a few seconds later by email or push notification. That raises availability but changes the customer experience, so it is a business decision as much as a technical one.
4Notifying the Warehouse After the Order Is Stored
Once the order is stored, the customer does not need to wait for the warehouse to react. The warehouse only needs to learn about the order reliably, eventually. So the order service publishes an OrderPlaced event and returns the confirmation straight away.
The important detail is reliability. If we save the order and then publish to Kafka, a crash between the two steps loses the event. The transactional outbox pattern fixes that: the order service writes the event into an outbox table in the same database transaction as the order, and a separate relay publishes rows from the outbox to the broker. The warehouse consumer must also be idempotent, meaning that processing the same event twice has the same effect as once, because brokers can deliver a message more than once.
8 messages in order. Play them, or step through them one at a time.
5The Rule Behind the Choice
Every step in this flow was decided by one question: does the caller need the result to continue? The order service cannot confirm without knowing about stock, so that step is synchronous. It can confirm without knowing when the warehouse picks the item, so that step is asynchronous. The same question decides payment authorisation (usually synchronous, the customer must know), confirmation emails and analytics (asynchronous), and loyalty points (asynchronous).
Applying the question step by step gives a system where the critical path is short and protected by timeouts, and everything else happens reliably in the background.
6Follow-up questions
What happens if inventory is down when a customer places an order?
With the synchronous reservation, the order service fails fast after its timeout and shows a clear message, perhaps with a retry option. If the business prefers to keep taking orders, we can accept the order as pending and reserve stock asynchronously, then confirm or cancel it later, accepting that a few orders may be cancelled for lack of stock.
Why not just use asynchronous messaging everywhere?
Because some steps genuinely need an answer, and forcing them into messaging creates request-reply over a broker, with correlation ids, reply topics and timeouts, which is more complex than an HTTP call with no real benefit. Messaging shines for notifications and work that many consumers react to independently.
How does the order service know the warehouse processed the order?
The warehouse can publish its own events, such as OrderPicked and OrderShipped, which the order service consumes to update the order status. The customer then sees the progress, and no service needs to call another synchronously to find out.
7Conclusion
In this answer, we saw that synchronous calls give immediate answers but couple the availability and latency of both services, while asynchronous messaging decouples them and absorbs load at the price of eventual consistency and extra machinery. For order placement, reserving stock is a synchronous step because the customer needs the result, and notifying the warehouse is an event published reliably through an outbox after the order is stored. The deciding question is always whether the caller needs the result to continue.
Open with
Synchronous REST gives the caller an immediate answer and is simple to write and debug, but it couples the two services in time: both must be up, latencies add up, and if the callee is down, the caller fails too.
Then, if they want more
Asynchronous messaging through a broker like Kafka decouples availability and absorbs load spikes, but the result is eventually consistent and we have to handle retries, duplicates and ordering. For order placement I would decide each step by asking whether the caller needs the result to continue.
Before confirming, the order service needs to know about stock, so I would make that synchronous, and rather than a plain check I would reserve the quantity in the inventory service, so two customers cannot both get the last item. That call has a short timeout and a clear failure response.
Once the order and reservation are stored, notifying the warehouse does not need to block the customer, so I would publish an OrderPlaced event. To make it reliable, I would write it to an outbox table in the same transaction as the order and have a relay publish it, and the warehouse consumer would be idempotent.
Emails and analytics would also be asynchronous, and the warehouse can report progress back with its own events.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Cloud documentation, Resilience4j documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Compare synchronous REST calls and asynchronous messaging between services. For an order...": https://scrivio-interview-library.netlify.app/spring-boot/microservice-design/44b0429bf3/