A developer is designing a message-based integration pattern for an e-commerce platform. Order event messages are published to an Amazon SNS topic, which fans them out to an Amazon SQS queue. A backend worker application polls the SQS queue and processes the events. The developer has two requirements for handling failed messages:
- If the SQS queue is temporarily unreachable or misconfigured (e.g., due to an incorrect IAM policy), any messages that SNS cannot deliver to the SQS queue must be captured for troubleshooting.
- If the backend worker application receives a message from SQS but fails to process it successfully after attempts, the message must be safely set aside.
Which configuration should the developer implement to satisfy both requirements?
- Configure an Amazon SQS queue as a dead-letter queue (DLQ) for the Amazon SNS subscription to capture delivery failures, and configure another SQS queue as a DLQ for the main SQS queue with a redrive policy specifying a maxReceiveCount of .Answer
- BConfigure a single Amazon SQS queue as a dead-letter queue (DLQ) on the main SQS queue, and set the SQS visibility timeout to at least three times the application processing time to allow SNS to automatically forward delivery failures to the same DLQ.
- CConfigure an Amazon SQS queue as a dead-letter queue (DLQ) at the Amazon SNS topic level, and configure a redrive policy on the SQS queue with a maxReceiveCount of pointing back to the SNS topic to retry delivery.
- DConfigure an Amazon SQS queue as a dead-letter queue (DLQ) for the main SQS queue with a redrive policy specifying a maxReceiveCount of , which will automatically capture both worker processing failures and SNS delivery failures to the queue.