In an Event-Driven Architecture (EDA), services are decoupled and communicate asynchronously via events. This section presents the end-to-end architecture topology and the detailed event processing flow for “The Cozy Brew” coffeehouse system.
Order Placement (Client Layer): The customer selects their beverage, customizes cup size (S / M / L), sets quantity, and provides brewing notes directly on the static web application hosted on Amazon S3.
Serverless Ingestion (Compute Layer): The web application performs an asynchronous HTTP POST request to the AWS Lambda Function URL. The Lambda function (order-publisher):
COZY-A1B2C3).drink, size, quantity, is_vip).Event Publishing (Messaging Layer): Lambda calls the sns:Publish API to broadcast the order event to the central CoffeeOrders topic in Amazon SNS without waiting for downstream fulfillment to finish.
Fan-Out & Automated Routing (Consumer Layer):
BaristaQueue): Receives all orders via an unfiltered subscription, enabling cafe baristas to pick up and brew drinks concurrently.VIPExpressQueue): Amazon SNS evaluates subscription filter policies. If quantity >= 5, the message is automatically duplicated and routed to the prioritized VIPExpressQueue.BaristaDLQ): If an order encounters malformed syntax or causes consumer crashes more than 3 times, Amazon SQS isolates the poison message into the Dead-Letter Queue (BaristaDLQ), keeping the primary queue unblocked.