AWS Certified Developer Associate DVA-C02 Practice Question
A developer is working on a serverless application where a certain AWS Lambda function is responsible for processing incoming messages from a message queue. Sometimes, this function encounters malformed messages that cannot be processed successfully. Which approach should the developer take to ensure that these problematic messages are segregated for troubleshooting without causing infinite processing retries?
Revise the message handling code to be idempotent, thereby ignoring any message that has the same content as a previously processed message.
Designate a dedicated queue to serve as a destination for messages that fail to be processed by the function.
Allocate more computational resources to the function to reduce the chances of a message being malformed due to resource constraints.
Adjust the message visibility setting in the queue to delay reprocessing attempts beyond the time frame the function requires to complete its execution.
Set the retry attempts configuration of the function to a minimum to prevent multiple processing attempts of the same message.
Capture exceptions within the code block and log error messages to a monitoring service without storing the problematic messages.