We just released a Community Technology Preview for Service Bus that provides a rich set of messaging capabilities. Service Bus is already unique amongst platform-as-a-service offerings in providing relay capability for services that allows for global endpoint federation across network and trust boundaries. In this release we focused on providing cloud-based, message-oriented-middleware technologies that include reliable message queuing and durable publish/subscribe messaging. These are accessible both over a simple and broadly interoperable REST-style HTTPS protocol with long-polling support and a throughput-optimized, connection-oriented, duplex TCP protocol.
In this post we will walk through the steps to download and run a simple application that showcases the publish-subscribe capabilities of Service Bus. You will need to have Visual Studio 2010 and NuGet installed.
We will start by creating a new console application in VS:
Open the Project –> Properties and change the Target framework to .NET Framework 4
From the References node in Solution Explorer click on the context menu item for Add Library Package Reference. This will show only if you have NuGet Extension installed. (To learn more about NuGet see this TechEd video).
Search for “AppFabric” and select the Windows Azure AppFabric Service Bus Samples – PublishSubscribe item. Then complete the Install and close this dialog.
Note that the required client assemblies are now referenced and some new code files are added.
Add the following line to the main method in Program.cs and hit F5
At this point you will be prompted to provide a ServiceNamespace and Issuer Name and Key. You can create your own namespace from https://portal.appfabriclabs.com/Default.aspx
Once a new namespace has been created you can retrieve the key from the Properties section by clicking View under Default Key:
These values can now be used in the Console application:
At this point you can run thru the different scenarios showcased by the sample.
Following are some additional resources:
Looking forward to your feedback / questions / concerns / suggestions.
To send data to or from the AppFabric Service Bus, whether it is a transactional message or a data stream, you need a connection to the AppFabric Service Bus. You can think of these connections as communication sessions between your application and the AppFabric Service Bus, which your application can “open” or “close” at any time. These connections result from opening services, opening client channels, or making HTTP requests against the AppFabric Service Bus.
Each URL in Windows Azure AppFabric is associated with at least one connection and the table below shows the maximum number of connections allowed in a single namespace. This limit no longer depends on the connection pack currently selected for the namespace.
|Connection Pack Selected||Connection Limit|
You can purchase as many pay-per-use individual connections as you like during any billing period, subject to system quotas and credit limits. You can also purchase up to one connection pack per namespace per billing period. If you decide that a larger or smaller pack is needed during a billing period, you can select a different pack size and the difference in price will be assessed on a pro-rated basis. You cannot change the pack size for a given service namespace more than once every seven days.
To configure the AppFabric ServiceBus Client SDK to target a specific host
In some scenarios you may want to target a specific ServiceBus instance from your client application. This can be achieved by either setting some environment variables or using a servicebus.config file.
For environment variable the following values have to be set:
The same information can be provided thru a servicebus.config file and following are some detailed steps for this:
1. Create the ServiceBus.config file with the following content and replace ALL the HostName entries below (e.g. servicebus.appfabriclabs.com etc.) with the appropriate host information (e.g. servicebus.windows.net etc.)
<?xml version=”1.0″ encoding=”utf-8″?>
<!– the root web configuration file –>
2. Copy the above ServiceBus.config file to the .NET Framework configuration directory or in the same directory as the executable.
The .NET Framework configuration directory depends on the operating system version being 32 bit or 64 bit and the framework version that you have installed, below are the
|Microsoft .NET Framework version 2.0 on 32 bit OS|
|Microsoft .NET Framework version 2.0 on 64 bit OS|
|Microsoft .NET Framework version 4.0 on 32 bit OS|
|Microsoft .NET Framework version 4.0 on 64 bit OS|