In this post I will show you code snippet to add message to an azure queue. I have written a function returning a Boolean value and taking a string input parameter to add as a message to the queue.
For your reference, the full source code is given below, public bool AddMessageinQueue(string MessageToAdd, string QueueName) { try { CloudStorageAccount account = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("DataConnectionString" ); CloudQueueClient queueClient = account.CreateCloudQueueClient(); CloudQueue queue = queueClient.GetQueueReference(QueueName); queue.CreateIfNotExist(); CloudQueueMessage m = new CloudQueueMessage(MessageToAdd); queue.AddMessage(m); return true;
} catch (Exception ex) { return false; } } In this way you can add message to an azure queue. I hope this post was useful. Thanks for reading. If you find my posts useful you may like to follow me on twitter http://twitter.com/debug_mode or may like Facebook page of my blog http://www.facebook.com/DebugMode.Net If you want to see post on a particular topic please do write on FB page or tweet me about that, I would love to help you.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: