Philipp Sambohl
Philipp Sambohl

Reputation: 25

AWS SQS multiple DLQs

we have currently a sqs queue for processing incoming data. Is there a recommended way for managing two DLQs for one queue?

Do I have to put the message manually into the dlq for the first szenario, or is there a better way?

Thanks!

Upvotes: 2

Views: 3444

Answers (3)

Jaffer
Jaffer

Reputation: 2968

SQS Supports only Single DLQ .

Alternatively what you could do is, Let the Consumer of the **Queue** Handle your first case. Meaning "if there is a parsing error of the incoming data" Let the Consumer Move it to another queue.

And The Second case of redrive policy will be handled Automatically and Moved to Real DLQ after the maxReceiveCount

Upvotes: 1

Marcin
Marcin

Reputation: 238051

You can have only one DLQ for an queue.

enter image description here

However, you could subscribe a lambda function to that one DLQ.

The lambda function could process the "bad" messages and distributed to other DQLs queues. So you could have additional DLQs for which the function would filter the messages.

Upvotes: 0

John Rotenstein
John Rotenstein

Reputation: 269091

An Amazon SQS queue only has one Dead Letter Queue.

If a message is read from an SQS queue more than a defined number of times, the message can be moved to the Dead Letter Queue for later processing. However, there is no control over what conditions will send the message to the Dead Letter Queue. It is simply based on a message being retrieved more than the maxReceiveCount.

See: Amazon SQS dead-letter queues

Please note that SQS itself does not process the message. Rather, you will have an app or an AWS Lambda function that reads the message from the queue and processes the message. Therefore, you could program your desired functionality (checking incoming data, responding to Mongo maxConnections) into the code that is processing the message from SQS. If it detects such a problem, that program could send the message to a specific queue, and then delete the original message from the source SQS queue.

This would have the same behaviour as having "multiple DLQs", except that your code is responsible for the logic of moving the messages to these queues, rather than Amazon SQS doing it.

Upvotes: 2

Related Questions