1

Is there any way in AWS SQS to route only the messages failed with particular error message to DLQ (Dead Letter Queue)?

By default, all the unprocessed messages are sent to DLQ. Is there any way to customize it based on error message?

Vinod Srivastav
  • 3,644
  • 1
  • 27
  • 40
Kingston X
  • 65
  • 5
  • 1
    No, but you might be able to stop some 'failed' messages being sent to the Dead Letter Queue by returning a 'success' code instead of an error code. Why are your messages generally failing? – John Rotenstein Apr 11 '23 at 09:48
  • If the consumer of the source queue fails to process a message a specified number of times defined as `maxReceiveCount` then only the message is moved to the dead-letter queue. That might be one of the reason other than error while processing the message. Kindly investigate to see what is the actual reason refer https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html form more info – Vinod Srivastav Apr 11 '23 at 20:05
  • Basically when the error is known, I do not want the SQS to retry the same message repeatedly. – Kingston X Apr 12 '23 at 10:20
  • @KingstonX If that is the requirement you have to handle the exception and return the `success code` as @JohnRotenstein is telling, you can also try to look to identify and move the message to `DLQ` using code or just look for `RedrivePolicy` – Vinod Srivastav Apr 12 '23 at 21:25

0 Answers0