A payments company processes card transactions for 40,000 merchant accounts. Transactions for the same merchant must be applied in the order they were submitted, but transactions for different merchants can be processed in parallel by a fleet of consumers. Producers sometimes retry a send after a network timeout, and a retried transaction must not be applied twice. Throughput must grow as merchants are added. Which design meets these requirements?
Choose one.
SQS FIFO ordering is scoped to a message group; parallelism comes from having many groups, and deduplication is by deduplication ID within a five-minute interval.
The requirement mixes three properties: per-merchant order, parallelism across merchants and suppression of retried sends. A FIFO queue with the merchant as the message group gives the first two, because consumers can work on different groups at once while each group is delivered in order. Setting the deduplication ID to the transaction ID gives the third. One fixed group serialises the whole queue, a standard queue does not order, and a random Kinesis partition key breaks the per-merchant order.
- Identify the ordering scope: per merchant, not global.
- Map that scope to the FIFO message group ID so groups run in parallel.
- Map the business identity of a send (the transaction ID) to the deduplication ID.
- Reject designs that order globally (no scale) or not at all (standard queue, random key).
Exam tip: Order by the narrowest key the business needs: one message group (or partition key) per entity, never one for everything.
SAP-C03 Event-Driven, Serverless and Multi-Tenant Architecture — the lesson that teaches this.