AWS SQS Deadletter queue configuration


I was exploring below scenario: I have one queue call ABC queue which has config as XYZ as dead letter queue. I can remove my dead letter queue xyz. Then I see message started coming back to main queue ABC queue and filing up my queue. I wanted to real production scenario how should we handle this scenario when dead letter queue is not available or deleted? Or AWS should have stopped before deleting that dead letter queue.

asked a year ago90 views
2 Answers

After deletion of the DLQ XYZ, the messages will not be able to be delivered to the DLQ, so there will be information about access deny, but I believe that all messages will be deleted after trying to be delivered to DLQ, so you will lose information about not processed messages.

To prevent it, you can for example deny deleting the queues on your account.

profile picture
answered a year ago
  • Thanks MG, But After I deleted DLQ, message is not getting delivered to XYZ Dead letter queue, so message appearing back to ABC- main queue. It is not deleting, keeping listing in ABC queue.

  • Ohh, I assume that "deleted" mean that it is removed as integration from normal SQS. Then without DLQ the messages will be processed as you wrote until the message expires. The only way to control it is to attach DLQ. If you want, you can ignore messages on DLQ or expire them very early.

    The expiration time is described here in a Q: How long can I keep my messages in Amazon SQS message queues? or here.

  • nice explanation MG


The msgs in your dead letter queue gets deleted with your queue, the new msgs in your queue "ABC" are piling up because there is no more dead letter queue. If you don't want to have a dead letter queue you should remove your messages so they don't pile up.

Update: Removed the following since its not applicable as clarified by soumitra.

I am assuming from your question you don't want to process failed msgs but delete them automatically, you can have a dead letter queue with msg expiry set to just 1 minute or 1 day so it automatically deletes the failed msgs if you don't want to process them. This way all failed msgs will goto your DLQ and will be deleted after the msg expiry.

answered a year ago
  • my question is more on real life scenario where somehow your dead letter queue XYZ is unavailable or stop working or deleted wrongly, then message started pile up in main queue like ABC and you will have unnecessary message in ABC Queue. you do not go and delete message from prod environment and you do not know which message need consume and delete. how to handle this scenario?

  • Thank you for clarifying the delete scenario. this is a production incident, how can your DLQ gets deleted wrongly? And if your DLQ gets deleted you should get notified via your monitoring system so you can fix the situation. If your DLQ can get deleted wrongly then your main queue can also get deleted? What you will do in that case?

  • Thanks hameedullah. There are difference between DLQ deletion vs main queue deletion scenario is I can ask producer to produce it again. I can get all message back. there are several reason one queue can stop working for sometime, like queue depth and network. As per your suggestion I see one option stop producer, purge queue, set up new dead letter queue. is this a good option, do you agree?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions