INTRODUCTION
Amazon SQS (Simple Queue Service) Dead Letter Queues (DLQs) are a feature that helps manage message processing failures in your messaging workflows. When messages in a standard SQS queue fail to be processed successfully after a certain number of attempts, they can be automatically sent to a DLQ.
DLQs can also be monitored for metrics like the number of messages and errors, which can help you maintain the health of your messaging system.
How To Works
For this task, we will establish a primary testing queue along with a Dead-Letter Queue.
- Navigate the SQS service , and Click on the Create queue button.
2. Click the standard and , enter the queue name.
3.Message retenation period : Enter 14 Days.
4. Then next , click on create Queue button.
5. Once you click on Create Queue, you will get a success message.
6. Next, we’ll set up a Primary Queue using all default options and link it to the previously created queue.
7. Click on Create queue button and , Select the standard and , enter some other queue name.
9. Select the Dead-letter queue and click on enable.
10. Choose queue : Select My queue arn , and select the Maximum receives : Enter 1
11. Click on the Create queue button.
12. We are now going to send a message from our Testing Queue.Click on Send and receive messages button.
- Send message
- Message body : Enter ” Hellow my first message”
Now click on Send message .Once you have sent a message, you get an acknowledgment .Now we can see that Messages available changes to 1.
Now, to get all the messages we have sent, click on Poll for messages in the Receive messages section.We can now see the message column has been filled with the messages .
Now, click the message to open and read its body.
Now, click on poll for messages again. You will see the messages available will become 0.
we received the message once and added the received count to 1 limit to the Queue 2 this time the message we polled has been moved into the My -queue. Now, let’s navigate to the Queue Dashboard and check the message available count in both queues.
You might find the message availability in My-Queue is 1 and Queue-2nis 0.
Now click on My-Queue to check the message and click on Send and receive messages.
Now, to get the message, click on Poll for messages in the Receive messages section. Additionally, take note of the receive count which is 2 that means it is same message which we received on Queue-2.
Click on the message to view its body and confirm that it is identical to what we sent earlier.
CONCLUSION
You have successfully set up a dead-letter queue.
Its features, such as message queuing, FIFO (First-In-First-Out) ordering, and the ability to integrate with other AWS services, make SQS a versatile tool for managing workloads in cloud environments. However, organizations should consider best practices for message handling, monitoring, and cost management to fully leverage SQS’s capabilities. As businesses increasingly move towards cloud-native solutions, SQS stands out as a key component for efficient and scalable application development.
Add a Comment