Picture a bike rental system where a bike is reported as "returned" before its "rented" event has been processed. The dashboard now shows the bike out on the street, even though it is parked at the station. Switching to an SQS FIFO queue looks like the obvious fix. In my experience, it is only half of one.
I recently wrote a detailed walkthrough on SQS FIFO with Lambda , including a complete CDK project. Here is the condensed version of what I learned while building it.
Order belongs to the message group, not the queue
FIFO in Amazon SQS does not mean one global line. Order is only guaranteed among messages that share the same message group ID. Messages from different groups may overtake each other and are processed in parallel.
That makes the group ID the most important design decision. A constant ID such as "default" gives you strict global ordering, but also only one batch in flight at a time, so a single slow message blocks everything.β¦