1
votes

I have an AWS SQS FIFO queue to handle a sequence of messages that comes in. Ideally, my consumer (a Lambda) will retrieve ordered messages at a cadence and attempts to reprocess them. My question here is whether should I add a dead letter queue?

  • I would like to process the messages on SQS in order, and it seems that 1st message in the message group will block every other message in that group if not processed.
  • I currently have message group ID all set to the same thing, despite some messages are not really dependent on the orders

Current setup { 1st, group A } { 2nd, group A } { 3rd, group A }

Should I set message group ID up so it becomes { 1st, group A } { 2nd, group A } { 3rd, group B } so that the 3rd message can be processed even if the 1st fails to process?

Should I go further in setting up a dead letter queue so there's another queue setting aside messages that cannot be processed correctly after a few attempts so it does not occupy my inflight message limitations?

1

1 Answers

3
votes

You should assign the same MessageGroupID to any messages that must be strictly processed in order relative to each other.

If you have messages that are not dependent on other messages, then they should have a different MessageGroupID.

The example I like to give is a fleet of buses sending GPS coordinates. All locations for a particular bus needs to be processed in order to show it correctly on a map, but messages from different buses can be processed in any order. Therefore, each bus should have its own MessageGroupID.