Question

Difficulty: MediumMessage-Based Integration using Amazon SQS and SNS

A retail platform uses an Amazon SNS topic to publish order transaction events. Two backend applications consume these events via individual Amazon SQS standard queues subscribed to the SNS topic. The first application, the Inventory Service, requires up to 5050 seconds to process a single transaction message. However, the developer notices that the Inventory Service is processing the same messages multiple times. The queue's default Visibility Timeout is set to 3030 seconds. The second application, the High-Value Alert Service, should only process transaction messages where the order total is greater than $1,000\$1,000. Which two configuration changes should the developer implement to resolve these issues? (Select TWO.)

  1. Set the Visibility Timeout of the Inventory Service's SQS queue to 6060 seconds.Answer
  2. Configure a subscription filter policy on the Amazon SNS subscription for the High-Value Alert Service's queue to filter based on the order total attribute.Answer
  3. C
    Enable message deduplication using a content-based deduplication ID on the Inventory Service's SQS standard queue.
  4. D
    Increase the execution timeout of the Inventory Service's consumer application to exceed the message processing duration without modifying the queue configuration.
  5. E
    Hardcode the IAM Access Key ID and Secret Access Key inside the Inventory Service's code to eliminate credential retrieval latency.

Answer

Configure the Inventory Service's SQS queue Visibility Timeout to 6060 seconds, and configure an SNS subscription filter policy on the High-Value Alert Service's queue subscription to filter messages based on the order total.
Setting the visibility timeout to 6060 seconds ensures that the Inventory Service has enough time (up to 5050 seconds) to process and delete the message before it becomes visible to other consumers. Configuring an SNS subscription filter policy ensures that only order events exceeding $1,000\$1,000 are delivered to the High-Value Alert Service's queue.

Step-by-Step Solution

1
Analyze the duplicate processing issue in the Inventory Service.
The message processing takes up to 5050 seconds, but the SQS visibility timeout is only 3030 seconds. This causes the message to become visible to other consumers before processing completes, leading to duplicates.
To prevent duplicates due to processing delays, the queue's Visibility Timeout must be set to a value greater than the maximum expected processing time (6060 seconds).
2
Analyze the message filtering requirement for the High-Value Alert Service.
Only messages with an order total greater than $1,000\$1,000 should be routed to this queue.
SNS subscription filter policies allow filtering at the subscription level before messages are pushed to the SQS queue.

Key Concept

Decoupled architecture message routing and visibility control using SQS Visibility Timeout and SNS Subscription Filter Policies.
Estimated Time:2m 0s
Rate this question