In this article we would demonstrate how SQS works in AWS. SQS provides an API endpoint to submit messages and another endpoint to read messages from a queue.
- Go to AWS console and click on SQS service
- Click on Create Queue
Here we would first create one standard queue and later would convert it to dead letter queue (DLQ). name. Under the Configuration, we would go with the default configuration except the Receive message wait time to 20s which is the maximum amount of time that polling will wait for the message to become available to receive.
Note: Amazon SQS does not create the dead letter queue automatically. You must first create the queue before using it as a DLQ.
Here, We just created a standard queue. Now to make it as DLQ, we would create an another standard queue with previous queue ARN.
Follow the same steps till Encryption part. Now under DLQ, Enable the DLQ option and provide the queue ARN which we created at the beginning.
Set the Maximum Receives as 3 as it can be any value between 1 to 1000. This is basically the maximum time the message can be received before it goes to DLQ.
Now we just created two queues for demonstrating standard queue operation.
4. Send Messages – Select the standard queue the click on Send and Receive Messages
You could also set the attributes which is optional.
Once you click on Send Message, it would prompt you below message with message ID, MD5 message body and message attributes in view details.
5. Receive Message – Select the queue and click on Send and receive messages. Once you scroll below, you would see the Receive message if any. Then click on Poll for messages
It would retrieve the message from queue. You could also read the message content from view details.
6. Now lets process that message by deleting it.
Now, you would be able to see the message has been moved to DLQ. In this way, you could send multiple messages under standard queue and test out the SQS queue functionality. You could also follow the same steps to create FIFO queue which works with first-in-first-out delivery option and test this out.
I hope this blog helps to understand how SQS queue works. Please like and comment if you have any queries related to this blog.