Lab 4 Configuring the System to use Simple Queue Service

Lab 4 Configuration the system to use Simple Queue Service

By using AWS SQS data will be transfer between application components and it is helps to decouple these components. This offers a very reliable, high-scalable hosted queue for storing messages as they travel between applications or microservices. It is support FIFO queues and standard queues. By using SQS it is very simple and cost effective to decouples and coordinate the components  of a cloud application. Using SQS you can send, store, receive messages in between software components without data lose and not required more other services for this process.

This lab Will cover following steps which is as bellow,

  1. Create queue in Amazon SQS.
  2. Change in existing code which in on local system.
  3. Place a order process.



Step .1 To create SQS first open AWS console and click on SQS service which is in side messaging service,


Now You are in main dashboard of SQS, Click on Get start now to create a SQS,


In this page you are going to give a name of that SQS and select which type of SQS you need, I selected Standard Queue and press quick create queue,



After this process you can see a newly created SQS in the table, now to send a message just go to the Queue Action and select send a message,


By selecting sending message you can see a new popup box on the screen, just type a message in message body and hit on send message,


In the next step to view that message just click on action tab again on the top and select View/Delete Message from SQS which is your created SQS, and you can see a fetching process in % and also can see a message which you sent it before,


Step 2.  After that process we have to change some codes in the local files which is use to connect tot his SQS so for that just open your local application and open Checkout.aspx.cs page form the Secure folder and delete a code from line 66 to 126 and put a new code which is given by your tutor as per the give document, but before going to do this just copy the URL of the created SQS,


In this code you have to change the URL in request.QueueURL option and copy that URL in here,

After that go to the top of this page and add some directory which is use to do a process, directory for Amazon.SQS and Newtonsoft.json which is for json format.

Namespace is the Logical group of types or we can say namespace is a container like Class, Structures, Interfaces, example System.IO logically groups input output related features , System.Data.SqlClient is the logical group of Connectivity with SQL server related features. In Object Oriented world, many times it is possible that programmers will use the same class name, Qualifying Namespace with class name can avoid this collision.


Step .3 After changing this code just open Nuget Packages and install Package.


After installing this package just open a web.config file and change some credentials for the connections as given bellow, then open Web.config file to add some credentials as follow, you need to add secret and access key of your AWS account and also on which region you are working,


Step 4. After all this changes just browse your application and login with a proper credential and add some products in to the cart,

Give some fake credit card details for the test use and hit on Buy Now button,


After this complete buying process just go to the AWS cloud and open the SQS services and take a look for the messages for the products which you bought in last step,


To check the details for the message just click on message details and you are able to see a complete details of that message,


Step 5. After this process also go to the code and open program.cs file to change a code and add Queue URL which is copied from the SQS services before, there are two queue URL use one is for request and second is for batch request, you have to change both of them,


After this change just go to the App.config file in the same folder and add Access and secret key also provide an region over there, and in the connection string provide a DB connection to connect with DB and insert an entry for the order by using this process,


Step 6. Now we are trying to change a start up page or a initial process so just click on the new project and make it as a startup and also there is one more change for this just go to the properties and click on signing and over there you could see single the click once manifests which one is tick already, just untick it and save that changes,



After that you need to click on start button at top in the visual studio to run the code. An application will came up as below image. It states that a order came into the queue of the application and it has been deleted. After complete a process once it again starting for polling to fetch a message from the queue. To stop this process just press X key and it will be stop.


At the end you can see a database of the order list, over there you could see a list of the items which you ordered in this complete process,



Error 1

‘ReceiveMessageRequest’ does not contain a definition for ‘AttributeName’ and no extension method ‘AttributeName’ accepting a first argument of type ‘ReceiveMessageRequest’ could be found (are you missing a using directive or an assembly reference?)


For this error ‘ReceiveMessageRequest’ does not contain a definition for ‘AttributeName’. So you need to inspect the definition of ‘ReceiveMessageRequest’ to verify if it has a member named ‘AttributeName’.

To get to the definition of ‘ReceiveMessageRequest’:

1. First, double click the error at the bottom of the visual studio. This will redirect you to the line where the error was detected.

2. Now right click ‘ReceiveMessageRequest’ and select “Go To Definition”.

In the definition, we can observe that ‘ReceiveMessageRequest’ class has a member named ‘AttributeNames’ and not ‘AttributeName’. This means that code in Program.cs is incorrect.

Modify request.AttributeNametorequest.AttributeNames. It should have letter “s”.


Error 2

ERROR for namespace “Amazon” not found then install AWSSDK Package form the NuGet manage Packages.

ERROR for namespace “Newtonsoft” not found then install latest Json.NET package from the NuGet Manage Packages.



In this lab, SQS services used to handle all the secure message in a queue and stores it  into the database very securely. In this lab will make you understand how confidential data is stored in the database using SQS. Also, you will learn how to create an application running side by side because every time it is not possible to do every process manualy.

Budget Plan
For Amazon SQS there is no minimum charges for creating any SQS services, they will charge you what ever you want. The will provide some free request which is around 1 million and in this free request some applications will cover their requirements.

There are two different types for the SQS one is FIFO and second one is Standard.

Normally after finishing that free request they will charge for FIFO it will  be $0.50 per 1 million request and for Standard they will charge $0.40 per 1 million request.

For Data Transfer charges it will be free to transfer data in same region bub to transfer data to the out of the region they will charge $0.140 per GB for first 10 GB.


Leave a Reply

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

You are commenting using your 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