Visual studio extension (context menu) for Azure Service Bus

As a part of my azure service bus learning, I always ended up creating console/win form/test projects for submitting messages to either a queue or topic. It was the same repetitive code always, but the following  always ended up being different…

1) Name of the Queue or Topic

2) key and issuer

3) Service Namespace

4) XML Bridge (EDI ??)


Being a BizTalk Dev/Architect for most of my IT career, we select files with right click for testing a map..etc, keeping this in mind, I came up with a visual studio context menu extension(on how-to will be another blog post), which does the following.

For any selected file in visual studio it can submit to either a queue or topic, the following image should be self explanatory.



For this release we need to have the following key/value pairs in the appsetting section of the project configuration file. The future release will include a property window or submenu.

 <appSettings >
    <add key="Topic" value="topictest"/>
    <add key="Queue" value="test"/>
    <add key="Issuer" value="owner"/>
    <add key="Key" value=""/>
    <add key="ServiceNamespace" value="/>

In the background I use a messagesender class to stream the files (it can be any type) to the service bus

// Read the selected file in the project  
// and pass this into the the brokedmessage constructor.
var fileStream = new FileStream(this.selectedFile, FileMode.Open);
using (var message = new BrokeredMessage(fileStream, true))

But what if we want an object to be published to a queue or a topic, Simple we serialize this to a file stream, include it into the project and send it to the queue, how?

private void SerializePizza()
  DataContractSerializer ds = new DataContractSerializer(typeof(PizzaOrder));
    using (Stream s = File.Create("pizza.xml"))
       ds.WriteObject(s, this.GetOrder());

And in the receiver we de serialize that back into the pizza object.

XmlObjectSerializer cc = new DataContractSerializer(typeof(AzureAddin.PizzaOrder));
 Console.WriteLine(string.Format("Pizza Quantity: = {0}", 


Note: This is the first release we will be adding more functionality in the future releases

1) A Property grid for selecting the topic, subscription or the queue

2) A collection property to specify the BrokeredMessage properties

3) Subscription support.

4) EDI Support

You can download the extension from the MSDN site