Skip Navigation LinksAzure Developers Guide > Azure Service Bus > Brokered Messaging > Direct Programming Model

Training Courses

All course material is in English, and courses are delivered in English. Feel free to contact me for further information. cloudcasts.net@gmail.com

Direct Programming Model

The service bus programming model provides an extensive array of classes that can be used to manage and interact with the service bus messaging artifacts. The classes used for message related functionality are contained in the following namespaces.

·        Microsoft.ServiceBus.Messaging

·        Microsoft.ServiceBus.Messaging.Configuration

Classes in Microsoft.ServiceBus namespace are also used when creating clients to manage queues topics and subscriptions, and authenticate with the service bus. The messaging namespaces are included in the Microsoft.ServiceBus version 1.5 assembly which is present in the Azure AppFabric September 2011 release.

A Note on the Code Examples

The majority of the code examples in this chapter will use the synchronous versions of methods, and exception handling will typically not be used. Whilst this is not recommended practice in real-world projects it has the advantage of simplifying the code and allowing the samples to focus purely on the use of the service bus brokered messaging classes.

The use of asynchronous methods and exception handling, along with other coding best practices will be covered in detail elsewhere in this book.

Project Configuration and Referenced Assemblies

In order to access the references required for using the direct programming model from Windows applications the target framework of the project must be changed from .NET Framework 4 Client Profile to .NET Framework 4. The majority of samples in this chapter will use C# console applications in order to focus purely on the AppFabric programming model. The project properties for these console applications has been changed as shown in the screenshot below.

Once this is done the following references should be added to the project.

·        Microsoft.ServiceBus

As Service Bus brokered messaging will often use WCF and data contract serialization classes internally it is often necessary to also add references to the following.

·        System.ServiceModel

·        System.Runtime.Serialization

 

Speaking Engagements