Question #822
An application running on AWS processes transaction records from an Amazon Simple Queue Service (SQS) queue and forwards the results to another SQS queue consumed by a legacy billing system. The billing system occasionally requires up to 10 minutes to finalize transactions and cannot tolerate out-of-order message processing. The developer cannot modify the legacy system's implementation.
Which solution guarantees that the billing system processes messages in the correct order?
Use an SQS FIFO queue. Adjust the visibility timeout setting appropriately.
Use an SQS standard queue with a SendMessageBatchRequestEntry structure. Configure the DelaySeconds parameter.
Use an SQS standard queue with a SendMessageBatchRequestEntry structure. Adjust the visibility timeout setting.
Use an SQS FIFO queue. Configure the DelaySeconds parameter.
Explanation
Answer A is correct because:
1. FIFO Queues: SQS FIFO queues ensure strict message ordering and exactly-once processing, which is critical for the billing system's requirement to avoid out-of-order processing.
2. Visibility Timeout: The billing system may take up to 10 minutes to process messages. Adjusting the visibility timeout to match this duration prevents other consumers from reprocessing the same message prematurely, ensuring no duplicates and preserving order.
Why other options are incorrect:
- B/C: Standard queues do not guarantee message order, making them unsuitable despite using SendMessageBatchRequestEntry or DelaySeconds.
- D: While FIFO queues ensure order, the DelaySeconds parameter delays message availability but does not address the need to keep messages hidden during prolonged processing.
Key Points:
- Use FIFO queues for strict ordering.
- Adjust visibility timeout to match processing time to avoid duplicates.
Answer
The correct answer is: A