A developer is building a serverless integration where an AWS Lambda function with a timeout of seconds processes messages from an Amazon SQS FIFO queue containing inventory updates. The system must guarantee that updates for the same product are processed in the order they are received, and messages should not be processed multiple times due to timeout discrepancies.
Which of the following configurations should the developer implement to meet these requirements? (Select TWO.)
- Set the MessageGroupId of each message to the product ID to ensure sequential processing per product.Cevap
- Set the SQS queue's visibility timeout to seconds or more to align with the Lambda function's timeout.Cevap
- CSet the SQS queue's visibility timeout to seconds to ensure that unprocessed messages are quickly retried.
- DSet the Lambda function's timeout to seconds while keeping the SQS queue's visibility timeout at seconds to allow the function more time to complete.
- EHardcode the AWS access keys within the Lambda function code to instantiate the SQS client.
Cevap
Setting the MessageGroupId to the product ID and configuring the SQS queue's visibility timeout to seconds or more.
To guarantee sequential processing of messages for the same product, the messages must belong to the same message group, which is achieved by setting the MessageGroupId parameter to the product ID. Additionally, to prevent duplicate message processing when integrating SQS with AWS Lambda, the queue's visibility timeout must be configured to at least times the Lambda function's timeout. Since the Lambda function has a timeout of seconds, the visibility timeout must be set to seconds or more.
Adım Adım Çözüm
Anahtar Kavram
Configuring SQS FIFO queues and visibility timeouts for reliable AWS Lambda integration.
Tahmini Süre:1m 30s