Amazon AWS | SQS

What is Amazon SQS?

Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. SQS eliminates the complexity and overhead associated with managing and operating message oriented middleware, and empowers developers to focus on differentiating work. Using SQS, you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be available.

 

Benefits

Eliminate administrative overhead

 

With SQS, there is no upfront cost, no need to acquire, install, and configure messaging software, and no time-consuming build-out and maintenance of supporting infrastructure.

 

Reliably deliver messages

 

SQS lets you decouple application components so that they run and fail independently, increasing the overall fault tolerance of the system.

 

Keep sensitive data secure

 

You can use Amazon SQS to exchange sensitive data between applications using server-side encryption (SSE) to encrypt each message body.

 

Scale elastically and cost-effectively

 

SQS scales elastically with your application so you don’t have to worry about capacity planning and pre-provisioning.

 

 

WorkFlow

The following scenario describes the lifecycle of an Amazon SQS message in a queue, from creation to deletion.

 

 

Getting Started with Amazon SQS

Before you begin, complete the steps in Setting Up Amazon SQS.

 

Step 1: Create a Queue

 

  1. Sign in to the Amazon SQS console.

  2. Choose Create New Queue.

  3. On the Create New Queue page, ensure that you're in the correct region and then type the Queue Name.

  4. Standard is selected by default. Choose FIFO.

  5. To create your queue with the default parameters, choose Quick-Create Queue.

 

Your new queue is created and selected in the queue list.

 

Step 2: Send a Message

 

After you create your queue, you can send a message to it. The following example shows sending a message to an existing queue.

 

  1. From the queue list, select the queue that you've created.

  2. From Queue Actions, select Send a Message.

  3. Your message is sent and the Send a Message to QueueName dialog box is displayed, showing the attributes of the sent message.

 

Step 3: Receive and Delete Your Message

 

After you send a message into a queue, you can consume it (retrieve it from the queue). When you request a message from a queue, you can't specify which message to get. Instead, you specify the maximum number of messages (up to 10) that you want to get.

 

Step 4: Delete Your Queue

 

If you don't use an Amazon SQS queue (and don't foresee using it in the near future), it is a best practice to delete it from Amazon SQS.

 

SQS Client

 

 

Events

OnSQSBeforeRequest

 

This event is called before sqs component does an HTTP request. You can get access to URL parameter and if Handled parameter is set to True, means component won't do an HTTP request.

 

OnSQSError

 

If there is any error when component do a request, this event will be called with Error Code and Error Description.

 

OnSQSResponse

 

This event is called after an HTTP request with raw response from server.