GA4

Sunday, July 20, 2014

Creation of Azure Queue and adding message to it

// Retrieve storage account from connection string

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(

CloudConfigurationManager.GetSetting("StorageConnectionString"));

// Create the queue client

CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();

// Retrieve a reference to a queue

CloudQueue queue = queueClient.GetQueueReference("myqueue");

// Create the queue if it doesn't already exist

queue.CreateIfNotExists();
//Create a message and add it in a queue

CloudQueueMessage msg = new CloudQueueMessage("Hello World");

queue.AddMessage(msg);
 

No comments: