- Newest
- Most votes
- Most comments
This is exactly how it should work. SQS FIFO maintains the order of all messages with the same group ID. To make sure that the order is preserved, if one consumer got a message with a specific group ID, no other consumer will be able to get messages with the ID until the message is deleted or becomes visible again. Otherwise, the messages can be processed out of order.
Nothing prevents a single consumer to get more than one message for the same group ID as the consumer knows the order of the messages (the order of the messages in the array) and it can process them in order.
If your code sends the messages to be processed in an asynchronous manner, you will break the order. You should process the messages one at a time. In order to process the messages quicker you should have multiple consumers, each will get messages from different groups IDs and this is how you will maintain the order and process the messages quicker.
Relevant content
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
Thanks, makes sense. So even if a consumer receives 10 messages from a single group and only confirms (deletes) the first one and dies, SQS will re-deliver the remaining 9 after the timeout regardless they were already delivered in a batch. I guess I will process them synchronously then.
Correct. Even if you receive a batch of messages, only the ones that are deleted will not be visible again. The other message will become available after the visibility timeout.