1
votes

I have an SQS queue linked to a deadletter queue via a redrive policy. Terraform sample:

  redrive_policy = jsonencode({
    deadLetterTargetArn = aws_sqs_queue.deadletter_queue.arn
    maxReceiveCount     = 10
  })

The queue processing is implemented with exponential backoff. If processing is successful the message is simply deleted. If processing fails it retries with an initial VisibilityTimeout of 30 seconds, which doubles each time, the final retry timeout (between 9th and 10th attempt) is roughly 2 hours.

My question is, after the final retry, when does the message get sent to the deadletter queue? Immediately after the 10th attempt or does it have to wait out the VisibilityTimeout (of about 4 hours)?.

My concern is that it seems redundant to put a visibility timeout on a message if it's just going to be sent straight to the deadletter - this delays alerts for example.

1
How did it go? Still unclear about the deadletter queue?Marcin

1 Answers

1
votes

If you have 4 hour visibility timeout, after 10 th attempt SQS will have to wait 4 hours before it can deem the attempt unsuccessfully. SQS can't assume that the attempt failed after 1 minute, if it may take 4 hours to process the message. SQS does not know what are you doing with the messages and has no means of checking if your application failed to process the message before visibility timeout expires.