AWS Certified Developer – Associate (DVA-C02)Development with AWS ServicesEasy

A developer is creating an AWS Lambda function that processes incoming messages from an Amazon SQS queue. The function occasionally fails to process certain messages due to transient issues with a downstream service. The developer wants to ensure that these failed messages are automatically retried and, if still unsuccessful after several attempts, moved to a separate queue for manual inspection. Which SQS feature should the developer implement?

  1. AMessage Timers
  2. BLong Polling
  3. CDead-Letter Queue (DLQ)
  4. DVisibility Timeout
Show answer & explanation

Correct answer: C. Dead-Letter Queue (DLQ)

A Dead-Letter Queue (DLQ) is used to handle messages that a consumer (like a Lambda function) fails to process successfully after a specified number of retries. It ensures that valid messages are not lost and can be inspected later.

Why the other options are wrong

  • A. Message Timers delay the delivery of messages to a queue, not for handling processing failures.
  • B. Long Polling reduces the number of empty responses by waiting for messages to arrive, not for handling failed messages.
  • D. Visibility Timeout prevents other consumers from processing a message that is already being processed, but it doesn't move failed messages to a separate queue.

SQS Dead-Letter Queue (DLQ)

A Dead-Letter Queue (DLQ) is a queue to which other (source) queues can send messages that are not successfully processed.

  • Captures messages that fail processing after retries.
  • Prevents message loss due to application errors.
  • Allows for manual inspection and debugging of failed messages.

Memory trick: When messages fail, the DLQ is their last trail.

More Development with AWS Services questions