Thursday, 15 June 2023

Amazon Web Services – Introduction to Simple Queue Service(SQS)

 This article will provide you with an introduction to AWS SQS. We will cover the difference between the queues and create our own.

What is SQS?

Amazon Simple Queue Service (SQS) will let you send the messages, store the messages, and receive the messages between various software components at any amount, without losing of  actual messages.  Also, without requiring some other services to should be available. so, basically Amazon SQS is a distributed queue system. SQS enables the  web service applications that helps to quickly and reliably queue the messages. These messages have one component in their application that generates only when to be consumed by another component. Therefore, the queue is a temporary repository for messages and these messages are awaiting processing. So, Once these messages are processed, the messages also gets deleted from the queue. SQS service basically adds the messages in a queue. and then, Users will pick up these messages from the queue.

A queue is a place where you can store your messages until they are extracted from the queue or expired. Queues are used to store textual information so it can be received and used by a consumer later on. 

The consumer is something that is getting a message from a queue. It can be anything that is able to make an API call to SQS (application, microservice, human, etc…). Using this paradigm we implement decoupling. 

The decoupling allows processing incoming requests later on. So when the consumer is overloaded it will just wait before getting another message. This way our applications become more fault-tolerant. 

Amazon Simple Queue Service(SQS) is a fully managed queue service in the AWS cloud. 

Customers Using SQS:-

1. Change HealthCare

2. NASA

3. CapitalOne

4. BMW

Types of Queues:

There are only two types of queues in SQS:

  1. First-in-first-out(FIFO) – in this queue the order of messages is preserved. So if you receive a message from the queue you will get the oldest message. This queue also guarantees that the message will be delivered only once. 
  2. Standart queue – in this queue messages are delivered randomly. Also, a message can be delivered multiple times. So you shouldn’t rely on order and only one-time delivery in this type of queues.

Important points to remember:

1. SQS is not push-based, it is basically on pull-based.
2. The size of messages in SQS are 256 KB.
3. There is default retention period in SQS. The default retention period is of 4 days.

4. Messages in SQS of a queue is kept from 1 minute to 14 days.
5. SQS also guarantees that the messages will only be processed at least once.

Creation of SQS via AWS console:

Follow the below steps to create a SQS using the AWS console:

  • Open AWS console and type “SQS” in the search bar. And select it.

  • Then hit “Create queue”.  You should see the following screen:

Every field has an Info clause. You can click on it and read about it if curious.

  • Let’s give our queue ‘geeky_queue’ name and hit “Create Queue”. For other fields defaults are fine.

No comments:

Post a Comment