Description : In this post how to remove queue from azure using c#. here same steps follow in my previous post for how to add message in azure using c#. and also check how to retrive queue from azure using c#
Step 1 : Downlod below NuGet package for add message using c#. Install both package one by one in your project use NuGet console or NuGet package managerr
- WindowsAzure.Storage
- WindowsAzure.ConfigurationManager
Step 2 : Get your connection string from Azure. Go to Azure Portal
Go to Storage Account -> Click on your storage account -> Inside Setting Click on Access keys -> In this window select Copy connection string. your connection string look like below
- DefaultEndpointsProtocol=https;AccountName=YourStorageAccountName;AccountKey=YourStorageAccountKey
Step 3 : Write below code for remove message from queue using c#
string ConnectionString = "DefaultEndpointsProtocol=https;AccountName=YourStorageAccountName;AccountKey=YourStorageAccountKey"
CloudStorageAccount account = CloudStorageAccount.Parse(ConnectionString); // Cloud Storage Account
CloudQueueClient queueClient = account.CreateCloudQueueClient(); // Queue Client Create
CloudQueue messageQueue = queueClient.GetQueueReference("YourAzureQueueName"); // Get Queue Reference
// this line for remove message from azure queue
messageQueue.DeleteMessage(MessageID, PopReceipt, null, null); // here message id is queue is get from azure and PopReceipt also you can get from queue
Step 1 : Downlod below NuGet package for add message using c#. Install both package one by one in your project use NuGet console or NuGet package managerr
- WindowsAzure.Storage
- WindowsAzure.ConfigurationManager
Step 2 : Get your connection string from Azure. Go to Azure Portal
Go to Storage Account -> Click on your storage account -> Inside Setting Click on Access keys -> In this window select Copy connection string. your connection string look like below
- DefaultEndpointsProtocol=https;AccountName=YourStorageAccountName;AccountKey=YourStorageAccountKey
Step 3 : Write below code for remove message from queue using c#
string ConnectionString = "DefaultEndpointsProtocol=https;AccountName=YourStorageAccountName;AccountKey=YourStorageAccountKey"
CloudStorageAccount account = CloudStorageAccount.Parse(ConnectionString); // Cloud Storage Account
CloudQueueClient queueClient = account.CreateCloudQueueClient(); // Queue Client Create
CloudQueue messageQueue = queueClient.GetQueueReference("YourAzureQueueName"); // Get Queue Reference
// this line for remove message from azure queue
messageQueue.DeleteMessage(MessageID, PopReceipt, null, null); // here message id is queue is get from azure and PopReceipt also you can get from queue
No comments:
Post a Comment