ASQS (Amazon Simple Queue Services)

Amazon SQS (Amazon Simple Queue Services) is a queuing service used for high-throughput, system-to-system messaging. You can use queues to decouple heavyweight processes and to buffer and batch work. Amazon SQS stores messages until microservices and serverless applications process them.

Steps to Implementing Amazon SQS

Create a Queue

You will have the provide the name of the Queue to create a simple queue in the Amazon cloud.

Create a QueueURL

After this, you have to create a queue URL that would basically build with your configuration you can create this on your own by providing your location, your queue name, etc.


Note: region_name is one of the most important parts of this queue url else this would process the complete flow but you will not be able to find the queue on amazon console, because of the region mismatch.

Process Queue

You need to create a message request with the queue URL and the message body and send it to the available queue.

Receive Message

The last step is to receive the messages sent to the defined queue. You need to create a receive request and call the receive request method of the SQS client.

You can follow the same process for using this simple queue service over the Amazon Console too. You need to login to the console first. After that, you will see a screen like this.

Type “Simple Queue Service” in the text box and select from the results shown on the screen.

Here, you will have the list of a queue available on your own AWS the above screenshot, I have created two queues named:

  1. TestingQueue
  2. TestingQueue1

I am going to show you a working example of the ASQS in .NET using Visual Studio.

Let’s begin.

Step 1

Install AWS Toolkit for Visual Studio.

Step 2

Create a Windows or web application or whatever you want. I have created a Windows.Form application and have taken two buttons one for creating the queues and other for processing the queue.

Step 3

After this, you need to set up your project to use the Amazon Services. First, you have to specify the Access Key, Secret Key, and Region in web.config if you are using the web application; and in app.config if you are using the Windows application.

Remember, the key name must be in the case as mentioned. and make sure you enter the correct region from aws console.

Step 4

After this, you need to install a few of the necessary .dll files from the NuGet Package Manager. You can add these required libraries from the NuGet Package Manager or PM> console by typing the name of the libraries, as shown in the references.

Installing .dll files

Now, it’s time to write a few lines of code for the same.

If you successfully processed the queue you will get the message. body + “found in Queue” message at message box.

If you have any queries or questions, I will be happy to answer.

Happy coding! Enjoy.

Source link

Write A Comment