A developer is configuring an Amazon SQS event source mapping for an AWS Lambda function that processes customer feedback messages. The SQS queue visibility timeout is configured to seconds. To optimize message processing, the developer wants to process messages in batches of up to , handle partial batch failures gracefully so that only failed messages are retried, and prevent message processing from timing out before the visibility window expires. Which combination of configurations will achieve these goals? (Select two.)
- Configure the Lambda function's timeout to seconds, ensuring the SQS queue visibility timeout is at least times the function's timeout.Cevap
- Configure the event source mapping to include ReportBatchItemFailures in the function response types, and return a list of failed message IDs in the response payload.Cevap
- CConfigure the Lambda function's timeout to seconds to match the SQS queue's visibility timeout exactly.
- DReturn an HTTP Internal Server Error status code from the Lambda function handler to signal SQS to retry only the failed messages.
- EConfigure the Lambda function to delete successfully processed messages from the SQS queue using the AWS SDK within the function code.
Cevap
Configure the Lambda function's timeout to seconds, ensuring the SQS queue visibility timeout is at least times the function's timeout, and configure the event source mapping to include ReportBatchItemFailures in the function response types, and return a list of failed message IDs in the response payload.
To handle partial batch failures in Amazon SQS event source mappings without reprocessing successful messages, developers should enable ReportBatchItemFailures in the FunctionResponseTypes of the event source mapping. The Lambda function must then return a JSON response containing a batchItemFailures list with the identifiers of the failed messages. Additionally, to prevent message processing from timing out and causing duplicate delivery before SQS visibility expires, the visibility timeout of the SQS queue must be configured to at least times the Lambda function's timeout. Since the SQS queue's visibility timeout is seconds, the Lambda function's timeout should be configured to seconds or less.
Adım Adım Çözüm
Anahtar Kavram
Integrating AWS Lambda with Amazon SQS involves configuring the function timeout relative to SQS visibility timeout to prevent duplicate processing, and utilizing ReportBatchItemFailures to handle partial batch processing errors efficiently.