How Amazon Simple Queue Service (SQS) works?

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.

  1. Go to AWS console and click on SQS service
  2. Click on Create Queue
3. In Create Queue option, we would first go though the Standard Queue option

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.

Now under Access Policy, we would go with the Basic method option where we would grant only the owner who can send and receive the messages from the queue.
Next, you do have option to encrypt your message with master key but here we would go with the default settings for now and same for DLQ and Tags which is optional.
Click on Create Queue to create our first queue.

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.

Click on Create Queue option.

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.

The message received would be updated to 0 after we process the message.

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: