Skip to content

Exploring messaging features in Azure AppFabric Service Bus

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:

image

Open the Project –> Properties and change the Target framework to .NET Framework 4

image

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).

image

Search for “AppFabric” and select the Windows Azure AppFabric Service Bus Samples – PublishSubscribe item. Then complete the Install and close this dialog.

image

Note that the required client assemblies are now referenced and some new code files are added.

image

Add the following line to the main method in Program.cs and hit F5

 Microsoft.Samples.PublishSubscribe.Program.Start(null);

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 

image

Once a new namespace has been created you can retrieve the key from the Properties section by clicking View under Default Key:

image

These values can now be used in the Console application:

image

At this point you can run thru the different scenarios showcased by the sample.

Following are some additional resources:

Windows Azure AppFabric SDK V2.0 CTP – May Update

User Guide for Service Bus CTP

Forum for feedback

Looking forward to your feedback / questions / concerns / suggestions.

Advertisements

Maximum Connections allowed per Service Bus Namespace

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
0 Pack 2000
5 Pack 2000
25 Pack 2000
100 Pack 2000
500 Pack 2000

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.

Additional information about AppFabric is available at:
1) Windows Azure AppFabric FAQ
2) Windows Azure FAQ

Configuring the Azure AppFabric ServiceBus Client SDK to target a specific host

To configure the AppFabric ServiceBus Client SDK to target a specific host
environment:

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:
RELAYENV=Custom
RELAYHOST=servicebus.appfabriclabs.com
STSHOST=accesscontrol.appfabriclabs.com

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 –>
<configuration>
<Microsoft.ServiceBus>
<relayHostName>servicebus.appfabriclabs.com</relayHostName>
<stsHostName>accesscontrol.appfabriclabs.com</stsHostName>
</Microsoft.ServiceBus>
</configuration>

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
typical locations:

Microsoft .NET Framework version 2.0 on 32 bit OS
%Windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG
Microsoft .NET Framework version 2.0 on 64 bit OS
%Windir%\Microsoft.NET\Framework64\v2.0.50727\CONFIG
Microsoft .NET Framework version 4.0 on 32 bit OS
%Windir%\Microsoft.NET\Framework\v4.0.30319\Config
Microsoft .NET Framework version 4.0 on 64 bit OS
%Windir%\Microsoft.NET\Framework64\v4.0.30319\Config
%d bloggers like this: