Exploring the Service Bus Relay, Queues,Topics and Subscriptions with Visual Studio 2012 RC and Windows Azure SDK 1.7

 

Introduction

In my post on Future BizTalk Server Release and Microsoft Integration Strategy I discussed the three pronged Microsoft integration strategy:
In this post I like to share my exploration of the Windows Azure Service Bus. My focus is on BizTalk professionals that do not yet have much experience/knowledge of the Windows Azure Service Bus.Two sessions by Clemens Vasters from last TechEd North America were my baseline before I started my exploration:
I will explore capabilities of Queues, Topics and the Relay as depicted in overview below of the Service Bus.

image

In picture above you see different solutions, devices that through services bus communicate with Line of Business applications (SAP, Oracle E-Business Suite), SharePoint and many other systems and applications.

The Windows Azure Service Bus offers capabilities that allow you to create solutions in the cloud that are based on message-oriented-middleware technologies including reliable message queuing and durable publish/subscribe messaging. Ergo its is a messaging infrastructure in the cloud. This means that Service Bus can act as a broker for asynchronous messaging (decoupling). Therefor this infrastructure can support publish-subscribe, temporal decoupling, and load balancing scenarios similar to BizTalk Server. Queues, Topics and Subscriptions are services (entities) of the Service Bus that provide durable, asynchronous messaging.

Relay is an entity that allows you to pass-through message (relay) from one system/application to another. Relay service that sits in Service Bus brings the ability to securely expose Windows Communication Foundation (WCF) services (even orchestrations or LoB Services) that reside within your enterprise network to the public cloud, without having to open up a firewall connection or requiring intrusive changes to your enterprise network infrastructure.

Note: Notifications topics and bridges are services (entities) in Service Bus that will be available later and are currently not present.


Get started


To get started I created a new VM with Windows Server 2008 R2 with Visual Studio 2012 RC and Windows Azure SDK 1.7. Now the SDK can also be used with Visual Studio 2010 SP1. You can use either VS2010 or VS2012 with this SDK.

Samples


The sample on the relay is a 101 sample on using the Relay. The other sample is more a walkthrough, using Queues, Topics and Subscriptions in the service bus by using the Service Bus Explorer. There illustrative to show the capabilities of these services if you are not familiar with them. You’ll need either Visual Studio 2010 SP1 or Visual Studio 2012 RC, Windows Azure SDK 1.7 (June 2012) and a namespace in Service Bus. Relay samples in this post and the walkthrough with the Service Bus Explorer is done in Visual Studio 2012 RC.

Create a namespace


To create a service namespace:



Service Bus NuGet Package


The Service Bus NuGet package is the easiest way to get the Service Bus API and to configure your application with all of the Service Bus dependencies. The NuGet Visual Studio extension makes it easy to install and update libraries and tools in Visual Studio and Visual Web Developer. The Service Bus NuGet package is the easiest way to get the Service Bus API and to configure your application with all of the Service Bus dependencies.
To install the NuGet package in your application, do the following:
image
image

Building a SIMPLE Relay Sample


To build a sample that will make use of relay service you need to create a WCF-service. The following steps show how to build a very basic service that can be exposed in the Service Bus.
image
image
image
image
image
image
image
image
image

Service Bus Explorer


One of new tools available through the SDK is the Service Bus Explorer. With the SDK installed you have access to several Azure features from Server Explorer.
image
To access the service bus through the Server Explorer:
image
image

QUEUES, TOPICS AND SUBSCRIPTIONS USING THE SERVICE BUS EXPLORER


To build a sample that will make use of queues, topics and subscriptions. These services support brokered messages. With the service explorer I can manage the service bus without using the portal (see previous paragraph). You can create queues through code or through using the explorer. Using the explorer you can right click Queues and add a new Queue.

image

Fill in a name, change some the values if necessary, click options and click Ok. You will then see your queue in Service Explorer.

image

You can right click the created queue and select Send Test a Message. You will then see dialog pop up with the message.

image

You will notice in the properties of the queue that the message count is 1.

image

With topics you can do the same. Right click topics and select Create New Topic….

image

Fill in a name, change some the values if necessary, click options and click Ok. You will then see your topic in Service Explorer.

image

Before you can send a message to the topic you need to create a subscription. Select subscriptions and right click. Select Create New Subscription ….

image

Fill in a name, change some the values if necessary, click options and click Ok. You will then see your topic in Service Explorer.

image

Like queues you can send a test message through the topic.You can right click the created topic and select Send Test a Message. You will then see dialog pop up with the message. In subscription properties you will see message count is 1.

image

On the subscription you can right click and select Receive Message. A dialog will pop up with the message.

image

Now you can create more subscriptions in the topic and then sent a test message. You will then see that both subscriptions in the topic will have that message. Now you can use rules to determine, which subscription will get which message. This is new functionality with topics and subscriptions. You can within a subscription add a rule. Open the desired subscription and right click rules. Select Create New Rule…. A dialog will appear.

image

Give it a name and add a Sql Filter Expression. Click Ok. You now have created a rule on the subscription.

Note: The Overview and Roadmap of Windows Azure Service Bus session of Teched NA will provide more context on Service Bus explorer. It will also demo using queues and topics with new Worker Role with Service Bus template.

Call to action


To learn more besides the two sessions from TechEd I suggest to look at Developing Applications that Use the Service Bus on MSDN, Alan Smith’s Developers Guide to AppFabric and resources listed below:
Update: Thanks to Paolo Salvatori I have been pointed some of the articles and samples he wrote on the Service Bus:
I myself got a little more feeling now with the new SDK and some of its features. My experience with the Service Bus explorer within Visual Studio 2012 RC so far has been great. It works seamlessly and is straight forward. Enjoy your own exploration!

Cheers,

- Steef-Jan

Labels: , , , , , , ,