A developer maintains an order application in which the web tier calls the fulfillment service directly over HTTP. During sales events the fulfillment service slows down, web requests time out, and orders are lost. The web tier must keep accepting orders even when fulfillment is slow or unavailable, and the orders can be fulfilled a few minutes later. What should the developer do?
Choose one.
A queue between two components removes the requirement that both are available and fast at the same moment.
The requirement is that the producer keeps working when the consumer is slow or down, and that work can happen later. That is the definition of temporal decoupling, which an SQS queue provides: the web tier enqueues and returns, and the fulfillment service consumes when it can. A load balancer, API Gateway and longer timeouts all keep a synchronous dependency in place.
- Identify the coupling: the web tier waits for fulfillment on every request.
- Note that a delay of minutes is acceptable, so the work can be asynchronous.
- Choose the component that stores work durably between producer and consumer: an SQS queue.
- Reject options that only scale or front the synchronous call.
Exam tip: If the caller does not need the result now, put a queue between it and the slow dependency.
DVA-C03 Application Development: Decoupling, APIs, SDKs, Events, Streams and AI — the lesson that teaches this.