Question

Difficulty: MediumMessage-Based Integration using Amazon SQS and SNS

A developer is designing a backend report generation system where users can request custom PDF reports. Due to network latency, the client application occasionally retries request submissions, resulting in duplicate messages being sent to the integration queue. The developer wants to ensure that if a request with the exact same payload is sent within a 5-minute window, the duplicate message is discarded and not processed. Which configuration will meet this requirement with the least development effort?

  1. Create an Amazon SQS FIFO queue and enable content-based deduplication on the queue.Answer
  2. B
    Create a standard Amazon SQS queue and set the visibility timeout to 300 seconds.
  3. C
    Create a standard Amazon SQS queue, configure an AWS Lambda function consumer, and set the Lambda execution timeout to 300 seconds.
  4. D
    Create an Amazon SQS FIFO queue and assign the user's IP address as the MessageGroupId for all messages.

Answer

Create an Amazon SQS FIFO queue and enable content-based deduplication on the queue.
Creating an Amazon SQS FIFO queue and enabling content-based deduplication is the most effective approach. When content-based deduplication is enabled, SQS automatically generates a SHA-256 hash of the message body to serve as the Message Deduplication ID. Any messages with the same body sent within the 5-minute deduplication window are recognized as duplicates and discarded.

Step-by-Step Solution

1
Identify the queue type needed to support message deduplication features natively.
Amazon SQS FIFO queues support message deduplication, whereas standard queues do not guarantee exactly-once delivery or message deduplication.
FIFO queues are required to prevent duplicate messages from being processed within the deduplication window.
2
Determine the mechanism to generate the deduplication ID based on message content.
Enable content-based deduplication on the FIFO queue.
This tells SQS to automatically calculate a SHA-256 hash of the message body to use as the MessageDeduplicationId, removing the need to generate and pass unique IDs from the client.
3
Confirm the deduplication window duration.
SQS FIFO queues enforce a fixed 5-minute (300 seconds) deduplication window.
This natively meets the developer's requirement to ignore duplicates within a 5-minute window without custom application logic.

Key Concept

Amazon SQS FIFO Queue Content-Based Deduplication
Rate this question