CodePark/ questions / SQS, SNS & EventBridge
START PRACTICINGPRACTICE
Backend question · Cloud & AWS › SQS, SNS & EventBridge

Payment events for the same customer must be processed in order, but different customers should be processed in parallel. How do you configure SQS?

A FIFO queue with MessageGroupId set to the customer ID

Use a FIFO queue with MessageGroupId set to the customer ID. A FIFO queue keeps order inside each message group. Different groups can be processed in parallel. So each customer's payments stay in order, and different customers run at the same time.

"A FIFO queue where every message uses the same
MessageGroupId" keeps the order correct. But it puts all customers into one single in-order stream, so nothing runs in parallel.

"A standard queue with a delivery delay" and "One standard queue per customer" do not work, because standard queues do not guarantee order, with or without a delay.