A food delivery platform emits order events from checkout that must be processed in order per restaurant, duplicates suppressed from retries, and failures retried without loss. Throughput is 300 TPS with Lambda consumers. Which messaging design provides ordering, idempotency, and delivery guarantees for this workload?
Select an answer to reveal the explanation.
Short Explanation
You can keep each restaurant’s orders in sequence and prevent retry duplicates from causing repeated effects. SQS FIFO gives you per-restaurant ordering, while idempotent Lambda handlers and a dead-letter queue help you handle retries safely.
Full Explanation
SQS FIFO with a MessageGroupId scoped to each restaurant preserves ordering within that group, and content-based or explicit deduplication suppresses retry duplicates within the deduplication window. An idempotent Lambda handler keyed on order ID, together with a dead-letter queue, supports at-least-once delivery while preventing repeated effects and helping ensure failed messages are not silently lost. SNS standard topics fanning out to SQS standard queues can scale throughput, but standard queues provide best-effort ordering and at-least-once delivery, so they cannot assure each restaurant’s sequence. Kinesis Data Streams partitioned by order ID would distribute a restaurant’s orders across partitions, breaking restaurant-level ordering; preserving it would require a restaurant key and careful consumer handling. EventBridge’s default bus offers durable routing, archives, and retries, but not the required strict per-key FIFO ordering and deduplication semantics. For the exam, distinguish FIFO message grouping and deduplication from exactly-once effects: application-level idempotency is still needed. In practice, verify the deduplication interval, visibility timeout, and durable storage of idempotency keys, such as in DynamoDB.