Tuesday, February 7, 2012

Azure Service Bus Sample code (F# version)

C# has already has the sample code for Azure service bus's "relayed messaging". After I apply for a Azure account, I decided to do a F# version just for fun. The code needs Azure 1.6 and Visual Studio 2010.

The code won't work because I hide my account key. Here is where to find your key in Azure management portal. In the UI, it called default key. I have to say the UI design is not bad, but finding something for a new user is not that easy.

Where to find the account key

If you want to start from scratch by referring to Service Bus Relayed Messaging Tutorial, the following are something you might want to pay attention to:

  • the project should be targeting to .NET 4. (not client profile).

  • define the interface method with parameter name.

[ < ServiceContract(Name = "IEchoContract", Namespace = "") > ]
type IEchoContract = interface
    [ < OperationContract > ]
    abstract member Echo : msg:string -> string

  • the tutorial is based on Azure SDK 1.5, so the app.config it provides has version = 1.5, you need to fix that to 1.6 as the latest download is 1.6.
  • the ServiceBus dll is located under C:\Program Files\Windows Azure SDK\v1.6\ServiceBus\ref
if you ever upgrade to 1.7 version, remember to update the app.config file and might have to use the key value in the "Service  identities" under "access control service".

This sample can also be found at F# 3.0 sample pack.

No comments: