Course menuDVA-C02

Exams / DVA-C02 / Architectural patterns and decoupling / Question 1

DVA-C02 practice question: Architectural patterns and decoupling (1 of 2)

Development with AWS Services A free question from our original DVA-C02 practice exam. Try it, then open the answer to see why each option is right or wrong.

A developer is building an order service. When an order is placed, three separate teams need the event: inventory, email confirmation and analytics. Each consumer must receive every order, process it at its own pace, and must not lose events if it is offline for a few hours. Which design meets these requirements with the LEAST coupling between the services?

Choose one answer.

  1. A. Have the order service call each consumer's REST endpoint in turn and retry any call that fails.
  2. B. Write each order to a single Amazon SQS standard queue that all three consumers poll.
  3. C. Publish each order to an Amazon SNS topic, and subscribe a separate Amazon SQS queue for each consumer.
  4. D. Publish each order to an Amazon SNS topic, and subscribe each consumer's HTTPS endpoint directly.
Show the answer and explanation

Answer: C

  • A. Wrong: This is synchronous and tightly coupled: the order service must know every consumer, and an offline consumer forces the producer to hold and retry events.
  • B. Wrong: Consumers of one queue compete for messages. Each order would be processed by only one of the three services, not by all of them.
  • C. Right: Correct. This is the fanout pattern: SNS copies each message to every subscribed queue, and each queue buffers events until its consumer is ready.
  • D. Wrong: Every consumer gets the event, but nothing buffers it for a consumer that is down for hours. A queue per consumer is what gives each one durable, independent storage.

Explanation

The SNS-to-SQS fanout pattern decouples the producer from its consumers. The order service publishes once and does not know who is listening. SNS pushes a copy to every subscribed queue, and each queue holds messages until its own consumer reads them, so consumers scale and fail independently.

Study

Keep practising

Answer questions with a score at the end, or practise just this topic with the explanation after each one. No sign-up needed.