A developer is implementing an IoT smart-home integration system. Devices publish telemetry and alert events to an Amazon SNS topic. These events must be fanout-routed to separate Amazon SQS queues: one for immediate alarm processing by an AWS Lambda function, and one for daily status archiving. The alarm events require up to seconds of processing time by the Lambda function, but alarms are currently being processed multiple times by the function. Which actions must the developer take to configure the message routing and prevent duplicate processing of the alarm messages? (Select TWO.)
- Configure an Amazon SNS subscription filter policy on the alarm queue's subscription to only accept messages with the 'alarm' attribute.Cevap
- Increase the visibility timeout of the alarm queue to seconds to exceed the Lambda function's processing time.Cevap
- CConvert the alarm queue to a FIFO (First-In-First-Out) queue to guarantee that messages are only processed once regardless of processing duration.
- DIncrease the timeout of the Lambda function to seconds while leaving the alarm queue's visibility timeout at the default seconds.
- EHardcode an IAM Access Key and Secret Key inside the Lambda function's code to authenticate with the Amazon SQS client.
Cevap
Configure an Amazon SNS subscription filter policy on the alarm SQS queue's subscription, and increase the visibility timeout of the alarm queue to seconds.
The correct configurations are setting up an Amazon SNS subscription filter policy and increasing the SQS queue's visibility timeout to seconds. Subscription filter policies allow the SQS queue to selectively ingest only 'alarm' messages, preventing unnecessary messages from being sent to the queue. Since the processing duration of the Lambda function can take up to seconds, increasing the SQS visibility timeout to seconds (which is greater than the -second processing time) ensures that messages remain invisible to other consumers while being processed, avoiding duplicate delivery.
Adım Adım Çözüm
Anahtar Kavram
Decoupling message-based integrations using SNS subscription filter policies and managing SQS visibility timeouts to prevent duplicate processing.