Azure queue storage
Queues are serially accessed messages of requests, which allow Web roles and worker roles to interact. It means whenever a new message will be added in a queue, the roles interact with that queue and pull the messages from in that queue one by one and ones the message has deliver to the roles that message will delete from the Queue.
Basically queue is the list of messages, which flows from the bottom from the queue to the top of the queue. They were added to the queue. Azure queues are located in Microsoft Cloud, which you can use for exchanging messages between the components either in the Cloud or in Premise.
Queues can store a large number of messages and a single queue can be up to 64 kb in size. Azure queue is used for passing the messages to an Azure worker role from an Azure Web role.
Out of the some advantages, queue has some limitations also such as the sent message should be in either text or binary format. Along with this, the individual message size can’t be more than 8kb in size.
I have a storage account. In the storage account, I have a queue and in this queue, we have multiple messages. We can have more than one message in a queue.

Let’s understand storage accounts practically. You have to be ready with the setup procedure given below.
- Visual Studio 2015.
- Microsoft Azure account.
With Azure storage account, you need to create a queue, which is a set of messages. Thus, let’s follow the steps given below.
Step 1
Create ASP.NET Web Project and a give a name to your project.
Step 2
Select MVC template.
Step 3
Right click on Project and add on Connected Services to connect with your Azure Storage account.
Let’s create an Empty Controller class in to your solution by right clicking Controllers folder.

Create a Method under your Controller and parse the connection string to retrieve your account detail from the key, which is in Web.Config file.
Create a client for your queue by passing the reference of storage account. As you have retrieved the reference of your queue by passing a queue name, createIfNotExists method will create your queue, if it does not exist and hold it in ViewBag.
- public class QueueStorageController : Controller
- {
- // GET: QueueStorage
- public ActionResult CreateQueue()
- {
- CloudStorageAccount yourStorageAccount = CloudStorageAccount.Parse(
- CloudConfigurationManager.GetSetting("mystoragecontainer002_AzureStorageConnectionString"));
- CloudQueueClient myQueueClient = yourStorageAccount.CreateCloudQueueClient();
- CloudQueue myQueue = myQueueClient.GetQueueReference("storagequeue");
- ViewBag.CreateSucess = myQueue.CreateIfNotExists();
- ViewBag.YourQueueName = myQueue.Name;
- return View();
- }
Add namespaces given below into your Controller.
- using Microsoft.Azure;
- using Microsoft.WindowsAzure.Storage;
- using Microsoft.WindowsAzure.Storage.Table;
Add a View for this Method.

Give a name to it and click Add.

Write the script given below to show a message on the Browser.














Join the conversation! Your thoughts help the community grow.