If you've seen my previous post then this post is quite similar, this time however I write to an Azure Queue and not to a blob.
First of all you need an Azure storage account as before, but once this is setup, consider the following code…
What I’m doing in the code above is
- Connecting to my storage account
- Creating the queue if it doesn't exist (remember you’ll get a bad request if you don’t name the queue correctly!).
- Then I create a simple message, I’m using an POCO object from another project and serializing it to JSON.
Did it work?
Lets use VS2013 U3 to check!
Open your server explorer and select the queue under the storage account you’ve chosen in your connection string, double click
Above you see the message added to the queue, you can see how many times it was de-queued and when it’s set to expire, If we use a competing consumer pattern that count may be more than 1!
I’m a little thorn re my next post, I’ve been writing a post on c# expression trees which is nearing completion, however I think to keep in line with the current trend I’ll post how this queue can be read and feed to an Azure Service Bus topic (pub/sub)… stay tuned ;-)