AWS Certified Developer Associate DVA-C01 – Question258

A company has an AWS Lambda function that reads messages from an Amazon Simple Queue Service (Amazon SQS) queue by using the Amazon SQS API. The Lambda function is not processing all the messages successfully because of random failures of a third-party dependency. A developer needs to improve the reliability of the Lambda function so that the Lambda function will process each message successfully despite the failures of the third-party dependency.
Which solution will meet this requirement with the LEAST effort?

A.
Move the call to the third-party dependency into an exception handling block. Write the message back to the SQS queue if a failure in the third-party dependency is caught in the exception handler.
B. Update the code in the Lambda function to remove calls to the SQS SDK ReceiveMessage function. Configure the Lambda function to use the SQS queue as an event source. Set the maxReceiveCount value on the SQS queue's redrive policy to at least 5.
C. Create a second SQS queue to use as a dead-letter queue. Configure a redrive policy on the original SQS queue to send failed messages to the dead-letter queue. Modify the Lambda function to read messages from both queues.
D. Create a second SQS queue to use as a dead-letter queue. Move the call to the third-party dependency into an exception handling block. Write the message to the dead-letter queue if a failure in the third-party dependency is caught in the exception handler.

Correct Answer: D