5/05/2015

Getting Started with Azure Service Bus

So today I created a 30 day trial account on the Microsoft Azure website.  Reason being, I'm a Microsoft Partner and an account holder for "Action Pack" which entitles free software downloads as well as Azure Cloud stuff.

So to get started, I provisioned my account, set to East Coast, and clicked on the Service Hub icon on the left hand toolbar.

From there, I created a Queue.  A Queue in traditional SQL Server is tied to a Service and Route and EndPoint.  I've set up a few databases to work with Service Broker, and it was not as simple as this is.

Getting Started: Messaging with Queues
https://code.msdn.microsoft.com/windowsazure/Getting-Started-Brokered-aa7a0ac3


Here' we created a queue called 'test1':

From the Service Bus page, you have a few options, listed here:


After downloading the sample project into Visual Studio 2013, it seems I'm missing some references.  So we need to download the SDK for Azure:
http://azure.microsoft.com/en-us/downloads/



Loaded references in Visual Studio project: NuGet, and it now compiles:


Now get the connection string from Azure Portal:


Indicating that we are missing SAS Policies configuration:

So that's easy to set up in a few clicks, I created a Test1 Shared Policy with full access / control:


If you go back to the main Queue page, there's a hyperlink to get the connection string with a copy button, which you can add to the Visual Studio 2013 app.config:



Next, comment out the method CreateQueue, as it apparently deleted my queue on Azure and wasn't able to recreate it.

Next, we renamed the Queue in the Visual Studio project to match the Queue name in Azure: test1



Compiled and ran, success~!



And the Azure view:

And there you have it.  Service Broker is a powerful took that not many people know about or utilize in production environments.  However, you can move lots of data from multiple places to multiple places, guaranteed delivery, asynchronous delivery and the messages get received in the order sent.  And lastly, if your server goes down you won't lose any data as it stores them up ready to flow once the server and queue is restarted.  Lastly, you can prioritize your queues for Low, Medium or High based on the business rules.

Thanks for reading~!


No comments:

Post a Comment

Root Cause Analysis