A developer is implementing a medical report analysis service where PDF files are processed by a consumer application. The application retrieves processing tasks from an Amazon SQS queue. Each task takes exactly seconds to complete. The developers observe that the same reports are frequently processed multiple times, causing duplicate entries in the database. Which configuration change will prevent these duplicate processing events?
- Increase the SQS visibility timeout to a value greater than seconds.Cevap
- BDecrease the SQS visibility timeout to seconds to allow faster retries.
- CIncrease the execution timeout of the consumer application without changing the queue settings.
- DStore long-lived AWS credentials inside the consumer application code to reduce authorization overhead.
Cevap
Increase the SQS visibility timeout to a value greater than seconds.
Increasing the SQS visibility timeout to a value greater than the message processing time (in this case, greater than seconds) ensures that the message remains invisible to other consumers while the active consumer is processing it. This prevents other consumers from retrieving and processing the same message simultaneously, resolving the duplicate processing issue.
Adım Adım Çözüm
Anahtar Kavram
SQS visibility timeout configuration relative to consumer processing time.
Tahmini Süre:1m 30s