All jobs / Solutions / cloud architect / Application Architecture
Solutions / cloud architect interview question · 0–1 years
When would you choose a REST call over publishing an event, and when the reverse?
The strongest answer
REST when the caller needs the answer now and owns the decision; an event when several parties may care and the publisher should not know who they are
Why it works
Exactly. Who needs the answer and who should know about whom decides it.
What a good answer covers
- Need the answer now? Call.
- Many interested parties? Publish.
- Publisher should not know consumers.
- Neither is “always”.
Answers that fall short
- Close, but not the strongest: REST for reads and events for writes
Read-versus-write is not the axis; plenty of writes need a synchronous answer. - Weak: Events always — they are more scalable
Events scale consumers, but they make “did it happen?” a harder question; use them where that is fine. - Red flag: REST always — events are impossible to debug
Events are harder to trace, not impossible; ruling them out rules out decoupling.
Who gets asked this
More Application Architecture questions
- What does designing an API “contract-first” mean, and why do teams do it?
- What does an API gateway do for you, and what should you resist putting in it?
- A client retries a “create payment” request after a timeout. How does the design stop a double charge?
- How do you version a public API so you can change it without breaking customers?
- Two services both need customer data. Who owns it, and how does the other get it?
- How do you keep a monolith modular enough that you could split it into services later?
- Booking a trip touches flights, hotel and payment services. How do you keep them consistent?
- How do you replace a large legacy system without a big-bang cut-over?