Question

Difficulty: MediumMessage-Based Integration using Amazon SQS and SNS

A developer is implementing a transaction processing system using an Amazon SQS FIFO queue. The system must process transactions in the exact order they occur. During testing, the developer notices that when two different transactions with identical message bodies are sent within two minutes of each other, the second transaction is discarded. Content-based deduplication is disabled on the queue. How should the developer modify the application configuration or message attributes to ensure both transactions are processed?

  1. A
    Increase the VisibilityTimeout parameter on the queue to be greater than five minutes.
  2. B
    Configure the consumer Lambda function's timeout parameter to match the SQS message retention period.
  3. Set a unique MessageDeduplicationId parameter on each sent message.Answer
  4. D
    Initialize the AmazonSQS client using hardcoded AWS access keys to bypass SQS message deduplication checks.

Answer

Set a unique MessageDeduplicationId parameter on each sent message.
Setting a unique MessageDeduplicationId on each sent message ensures that Amazon SQS treats transactions with identical bodies as distinct messages, preventing incorrect deduplication when content-based deduplication is disabled.

Step-by-Step Solution

1
Analyze the message discard behavior in the SQS FIFO queue.
The second message is discarded because it has an identical body to a message sent within the 5-minute deduplication window, and content-based deduplication is disabled.
SQS FIFO queues require a mechanism to distinguish between duplicate retries and distinct messages with the same payload.
2
Evaluate SQS FIFO deduplication parameters.
When content-based deduplication is disabled, SQS relies strictly on the MessageDeduplicationId token passed with the message.
A unique MessageDeduplicationId tells SQS that the message is distinct despite having the same body.
3
Select the correct option to configure.
Setting a unique MessageDeduplicationId on each message.
This allows both transactions to bypass the 5-minute deduplication check and be successfully queued.

Key Concept

SQS FIFO Message Deduplication
Rate this question