Soru

Zorluk: KolayMessage-Based Integration using Amazon SQS and SNS

A developer has an application that consumes messages from an Amazon SQS queue. The consumer application takes approximately 30 seconds to process each message. However, the developer notices that other consumers are picking up the same messages and processing them concurrently, leading to duplicate processing. Which configuration change should the developer make to resolve this duplicate processing issue?

  1. Increase the visibility timeout of the SQS queue to a value greater than 30 seconds.Cevap
  2. B
    Decrease the visibility timeout of the SQS queue to a value less than 30 seconds.
  3. C
    Configure the SQS queue's SDK client with hardcoded AWS credentials to bypass message processing delays.
  4. D
    Increase the execution timeout of the consumer AWS Lambda function while keeping the SQS queue visibility timeout at 15 seconds.

Cevap

Increase the visibility timeout of the SQS queue to a value greater than 30 seconds.
Increasing the SQS queue's visibility timeout to a value greater than the maximum message processing time (30 seconds) ensures that the message remains hidden from other consumers until the current consumer completes processing and deletes it from the queue.

Adım Adım Çözüm

1
Analyze the time required by the consumer to process a message.
The consumer requires 30 seconds to process a message.
This establishes the minimum time the message must remain invisible to other consumers.
2
Compare the processing time with the default or configured SQS visibility timeout.
If the visibility timeout is shorter than 30 seconds, the message becomes visible to other consumers before the current consumer completes processing.
To identify why duplicate processing is occurring.
3
Adjust the SQS visibility timeout parameter.
Setting the visibility timeout to a value greater than 30 seconds ensures the consumer can process and delete the message.
This prevents other consumers from retrieving the message while it is being actively processed.

Anahtar Kavram

Amazon SQS Visibility Timeout
Bu soruyu puanla