3
votes

In AWS SQS FIFO's Queues; when the visibility timeout of a readed message, in which possition of the queue will be the message?

For example:

  • I have these messages in queue: '[A, B, C, D]' (order: A first in)
  • I read a message from the queue so I get message 'A'
  • The visibility timeout of message 'A' expires and it's available again for a consumer

Which will be the new order of messages?

  • a) [A, B, C, D]
  • b) [B, C, D, A]
2

2 Answers

6
votes

The order remains the same: [A, B, C, D]

In fact, it is not possible to fetch another message from the queue with the same Message Group ID until message A has been processed. This ensures that the order is preserved.

Where certain messages are allowed to be processed in parallel, you can specify a different Message Group ID.

0
votes

[A, B, C, D] is correct if and only if all the messages share the same message group ID. If they do not, visibility timeout expiration will send the message to the back of the queue. ([B, C, D, A]).

The only way to process multiple messages simultaneously from an SQS FIFO queue is to use multiple message group IDs, which unfortunately breaks oldest message first ordering.