AWS SQS: Which is the order of message in a FIFO queue after visibility-timeout expires?
Asked Answered
G

2

5

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]
Gause answered 25/6, 2019 at 12:29 Comment(0)
U
9

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.

Unman answered 26/6, 2019 at 0:15 Comment(2)
Is this valid only for FIFO queues or for any SQS type?Hubey
@Hubey This is now the First-In-First-Out (FIFO) queue operates.Unman
W
-1

[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.

Wyman answered 10/12, 2019 at 21:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.