Author: Paolo Salvatori (@babosbird)

Introduction

Important Note

The zip file contains: 

Queues and topics represent the foundation of a new cloud-based messaging and integration infrastructure that provides reliable message queuing and durable publish/subscribe messaging capabilities to both cloud and on-premises applications based on Microsoft and non-Microsoft technologies. .NET applications can use the new functionality offered by queues and topics by using the new messaging API (Microsoft.ServiceBus.Messaging) or via WCF by using the new NetMessagingBinding. Likewise, any Microsoft or non-Microsoft applications can use a Service Bus REST API to manage and access messaging entities over HTTPS. In November 2012, the Service Bus for Windows Server was released. The Service Bus Exploer can be used with manage namespaces hosted by both Windows Azure Service Bus and Service Bus for Windows Server.
Queues and topics were first introduced by the Community Technology Preview (CTP) of Windows Azure that was released in May 2011. At that time, the Windows Azure Management Portal didn’t provide any user interface to administer, create and delete messaging entities and the only way to accomplish this task was using the .NET or REST API. For this reason, In June 2011 I decided to build a tool called Service Bus Explorer that would allow developers and system administrators to connect to a Service Bus namespace and administer its messaging entities.
 
During the last few months I continued to develop this tool and add new features with the intended goal to facilitate the development and administration of new Service Bus-enabled applications. In the meantime, the Windows Azure Management Portal introduced the ability for a user to create, disable, update queues, topics, and subscriptions and define their properties, but not to define or display rules for an existing subscription. Besides, the Service Bus Explorer enables to accomplish functionalities, such as importing, exporting and testing entities, that are not currently provided by the Windows Azure Management Portal. For this reason, the Service Bus Explorer tool represents the perfect companion for the official Azure portal and it can also be used to explore the features (session-based correlation, configurable detection of duplicate messages, deferring messages, etc.) provided out-of-the-box by the Service Bus brokered messaging.
For more information on the Service Bus, you can use the following resources:

Updates

Follow me on Twitter if you want to receive a post whenever a new version of the tool is available.

Videos

For more information on how to use the Service Bus Explorer, see the following videos on Channel9:

License

Microsoft Corporation (“Microsoft”) grants you a nonexclusive, perpetual, royalty-free right to use and modify the software code provided by us for the purposes of illustration  ("Sample Code") and to reproduce and distribute the object code form of the Sample Code, provided that you agree: (i) to not use our name, logo, or trademarks to market your software product in which the Sample Code is embedded; (ii) to include a valid copyright notice on your software product in which the Sample Code is embedded; and (iii) to indemnify, hold harmless, and defend us and our suppliers from and against any claims or lawsuits, whether in an action of contract, tort or otherwise, including attorneys’ fees, that arise or result from the use or distribution of the Sample Code or the use or other dealings in the Sample Code. Unless applicable law gives you more rights, Microsoft reserves all other rights not expressly granted herein, whether by implication, estoppel or otherwise. 

THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL MICROSOFT OR ITS LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE SAMPLE CODE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Windows Azure Management Portal

In order to use the Brokered and Relay messaging functionality provided by the Service Bus, the first operation to perform is to provision a new Service Bus namespace or modify an existing namespace to include the Service Bus. You can accomplish this task from the Windows Azure Management Portal.
Once completed this step, you can start creating and using queues, topics and subscriptions. You have many options to provision and manage messaging entities:
Using Windows Azure Management Portal is a handy and convenient manner to handle the messaging entities in a given Service Bus namespace. However, at least at the moment, the set of operations that a developer or a system administrator can perform using its user interface is quite limited. For example, the Windows Azure Management Portal actually allows a user to create queues, topics, and subscriptions and define their properties, but not to create or display rules for an existing subscription. At the moment, you can accomplish this task only by using the .NET Messaging API. In particular, to add a new rule to an existing subscription you can use the AddRule(String, Filter) or the AddRule(RuleDescription) methods exposed by the SubscriptionClient class, while to enumerate the rules of an existing subscription, you can use the GetRules method of the NamespaceManager class. Besides, the Windows Azure Management Portal actually does not provide the ability to perform the following operations:
That’s why in June, I created a tool called Service Bus Explorer that allows a user to create, delete and test queues, topics, subscriptions, and rules. My tool was able to manage entities in the Labs Beta environment. However, the new version of the Service Bus API introduced some breaking changes, as you can read here, so I built a new version of the Service Bus Explorer tool that introduces a significant amount of new features.

Service Bus Explorer

The following picture illustrates the high-level architecture of the Service Bus Explorer tool. The application has been written in C# using Visual Studio 2010 and requires the installation of the .NET Framework 4.0 and Windows Azure SDK for .NET. The tool can be copied and used on any workstation that satisfies the prerequisites mentioned above to manage and test the Brokered and Relay messaging services defined in a given Service Bus namespace.
 
Read the full article on MSDN.
NOTE: I'll continue to develop the tool and add new functionalities. So I strongly recommend you to visit this page from time to time for a new version.
Author: Paolo Salvatori
Update: 28 August 2012
This version introduces the following updates:
Update: 18 December 2012
This version introduces the following updates:
 
 
 
 
 
Update: 7 January 2013
This version introduces the following updates:
Update: 8 January 2013
This version introduces the following updates:
Update: 12 April 2013
This version introduces the following updates:


 
 
 
Update: 19 April 2013
This version introduces the following updates:
 
Update: 2 May 2013
This version introduces the following updates:
Update: 10 May 2013
This version introduces the following updates:

Update: 30 September 2013

This version introduces the following updates:

Important Note: the Service Bus does not allow to receive and delete a peeked BrokeredMessage by SequenceNumber. Only deferred messages can by received by SequenceNumber. As a consequence, when editing and resubmitting a peeked message, there's no way to receive and delete the original copy.

Update: 9 October 2013

This version introduces the following updates:

Update: 14 October 2013

This version introduces the following updates:

Update: 29 November 2013

This version introduces the following updates for both the 2.1 and 2.2 version:

ServiceBusExplorer.exe  [-c|/c] [connectionstring]
                                  [-q|/q] [queue odata filter expression]
                                  [-t|/t] [topic odata filter expression]
                                  [-s|/s] [subscription odata filter expression]

 

ServiceBusExplorer.exe  [-n|/n] [namespace key in the configuration file]
                                  [-q|/q] [queue odata filter expression]
                                  [-t|/t] [topic odata filter expression]
                                  [-s|/s] [subscription odata filter expression]

Example: ServiceBusExplorer.exe -n paolosalvatori -q "Startswith(Path, 'request') Eq true" -t "Startswith(Path, 'request') Eq true"

Update: 2 December 2013

This version introduces the following updates:

Update: 18 December 2013

This version introduces the following updates:

Update: 10 February 2014

This version introduces the following updates:

Update: 21 May 2014

This version introduces the following updates:

To enable or disable this feature, you can use the showMessageCount setting in the configuration file, or use the new Show Message Count checkbox in the Options Form as shown in the picture below.

Update: 20 June 2014

This version introduces the following updates:

 

Update: 18 July 2014

This version introduces the following updates:

 

XML
Edit|Remove
<appSettings    ... 
   <add key="selectedEntities" value="Queues,Topics,Relay Services,Event Hubs,Notification Hubs" /> 
    ... 
 </appSettings>

Options:

BrokeredMessage Json Template:

JavaScript
Edit|Remove
{ 
  "messageId""1", 
  "sessionId""", 
  "correlationId""", 
  "contentType""", 
  "label""Service Bus Explorer", 
  "partitionKey""", 
  "to""", 
  "replyTo""", 
  "replyToSessionId""", 
  "timeToLive""", 
  "scheduledEnqueueTimeUtc""", 
  "forcePersistence""false", 
  "message""{\"deviceId\":\"1\", \"value\":\"25\"}", 
  "properties": [ 
    { 
      "key""deviceId", 
      "type""Int64", 
      "value""1" 
    }, 
    { 
      "key""location", 
      "type""String", 
      "value""Room 1" 
    }, 
    { 
      "key""city", 
      "type""String", 
      "value""Milan" 
    }, 
    { 
      "key""country", 
      "type""String", 
      "value""Italy" 
    }, 
    { 
      "key""value", 
      "type""Int32", 
      "value""25" 
    } 
  ] 
}

EventData Json Template:

JavaScript
Edit|Remove
{ 
  "partitionKey""1", 
  "message""{\"deviceId\":\"1\", \"value\":\"25\"}", 
  "properties": [ 
    { 
      "key""deviceId", 
      "type""Int64", 
      "value""1" 
    }, 
    { 
      "key""location", 
      "type""String", 
      "value""Room 1" 
    }, 
    { 
      "key""city", 
      "type""String", 
      "value""Milan" 
    }, 
    { 
      "key""country", 
      "type""String", 
      "value""Italy" 
    }, 
    { 
      "key""value", 
      "type""Int32", 
      "value""25" 
    } 
  ] 
}

BrokeredMessage Xml Template:

 

XML
Edit|Remove
<?xml version="1.0" encoding="us-ascii"?> 
<brokeredMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
                 xmlns="http://schemas.microsoft.com/servicebusexplorer"  <label>Service Bus Explorer</label> 
  <forcePersistence>false</forcePersistence> 
  <message><![CDATA[{"deviceId":"1", "value":"18"}]]></message> 
  <properties    <property      <key>deviceid</key> 
      <type>String</type> 
      <value>1</value> 
    </property> 
    <property      <key>location</key> 
      <type>String</type> 
      <value>Room 1</value> 
    </property> 
    <property      <key>city</key> 
      <type>String</type> 
      <value>Milan</value> 
    </property> 
    <property      <key>country</key> 
      <type>String</type> 
      <value>Italy</value> 
    </property> 
    <property      <key>country</key> 
      <type>Int32</type> 
      <value>18</value> 
    </property> 
  </properties> 
</brokeredMessage>

EventData Xml Template:

XML
Edit|Remove
<?xml version="1.0" encoding="us-ascii"?> 
 
<eventData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
           xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
           xmlns="http://schemas.microsoft.com/servicebusexplorer"  <partitionKey>1</partitionKey> 
  <message><![CDATA[{"deviceId":"1", "value":"18"}]]></message> 
  <properties    <property      <key>deviceId</key> 
      <type>String</type> 
      <value>1</value> 
    </property> 
    <property      <key>location</key> 
      <type>String</type> 
      <value>Room 1</value> 
    </property> 
    <property      <key>city</key> 
      <type>String</type> 
      <value>Milan</value> 
    </property> 
    <property      <key>country</key> 
      <type>String</type> 
      <value>Italy</value> 
    </property> 
    <property      <key>value</key> 
      <type>Int32</type> 
      <value>18</value> 
    </property> 
  </properties> 
</eventData>
C#
Edit|Remove
namespace Microsoft.WindowsAzure.CAT.ServiceBusExplorer 
{ 
    public interface IBrokeredMessageGenerator 
    { 
        IEnumerable<BrokeredMessage> GenerateBrokeredMessageCollection(int messageCount, 
                                                                       WriteToLogDelegate writeToLog = null); 
    } 
}
XML
Edit|Remove
<?xml version="1.0" encoding="utf-8"?> 
<configuration  ... 
  <brokeredMessageGenerators    <add key="OnOffDeviceBrokeredMessageGenerator"  
         value="Microsoft.WindowsAzure.CAT.ServiceBusExplorer.OnOffDeviceBrokeredMessageGenerator,ServiceBusExplorer" /> 
    <add key="ThresholdDeviceBrokeredMessageGenerator"  
         value="Microsoft.WindowsAzure.CAT.ServiceBusExplorer.ThresholdDeviceBrokeredMessageGenerator,ServiceBusExplorer" /> 
  </brokeredMessageGenerators> 
  ... 
</configuration>

Messages generated by the component have the following payload and properties.

 

JavaScript
Edit|Remove
Payload: 
{"deviceid":93,"value":0} 
Properties: 
- Key=[deviceId] Value=[93] 
- Key=[value] Value=[0] 
- Key=[time] Value=[635398156544407695] 
- Key=[city] Value=[Milan] 
- Key=[country] Value=[Italy]

 

Messages generated by the component have the following payload and properties.

 

JavaScript
Edit|Remove
Payload: 
{"deviceid":93,"value":97} 
Properties: 
- Key=[deviceId] Value=[93] 
- Key=[value] Value=[97] 
- Key=[time] Value=[635398156544407695] 
- Key=[city] Value=[Milan] 
- Key=[country] Value=[Italy]

 

C#
Edit|Remove
namespace Microsoft.WindowsAzure.CAT.ServiceBusExplorer 
{ 
    public interface IBrokeredMessageInspector 
    { 
        BrokeredMessage BeforeSendMessage(BrokeredMessage message,  
                                          WriteToLogDelegate writeToLog = null); 
        BrokeredMessage AfterReceiveMessage(BrokeredMessage message,  
                                            WriteToLogDelegate writeToLog = null); 
    } 
}
XML
Edit|Remove
<?xml version="1.0" encoding="utf-8"?> 
<configuration  ... 
  <brokeredMessageInspectors    <add key="LogBrokeredMessageInspector"  
         value="Microsoft.WindowsAzure.CAT.ServiceBusExplorer.LogBrokeredMessageInspector,ServiceBusExplorer" /> 
    <add key="ZipBrokeredMessageInspector"  
         value="Microsoft.WindowsAzure.CAT.ServiceBusExplorer.ZipBrokeredMessageInspector,ServiceBusExplorer" /> 
  </brokeredMessageInspectors> 
 ... 
</configuration>
 The tool provides two BrokeredMessage generators out of the box:

BrokeredMessage inspectors can be selected under the following dialogs:

 

C#
Edit|Remove
namespace Microsoft.WindowsAzure.CAT.ServiceBusExplorer 
{ 
    public interface IEventDataGenerator 
    { 
        IEnumerable<EventData> GenerateEventDataCollection(int eventDataCount,  
                                                           WriteToLogDelegate writeToLog = null); 
    } 
}
XML
Edit|Remove
<?xml version="1.0" encoding="utf-8"?> 
<configuration  ... 
  <eventDataInspectors    <add key="LogEventDataInspector"  
         value="Microsoft.WindowsAzure.CAT.ServiceBusExplorer.LogEventDataInspector,ServiceBusExplorer" /> 
    <add key="ZipEventDataInspector"  
         value="Microsoft.WindowsAzure.CAT.ServiceBusExplorer.ZipEventDataInspector,ServiceBusExplorer" /> 
  </eventDataInspectors> 
  ... 
</configuration>

Messages generated by the component have the following payload and properties.

 

JavaScript
Edit|Remove
Payload: 
{"deviceid":93,"value":0} 
Properties: 
- Key=[deviceId] Value=[93] 
- Key=[value] Value=[0] 
- Key=[time] Value=[635398156544407695] 
- Key=[city] Value=[Milan] 
- Key=[country] Value=[Italy]

 

Messages generated by the component have the following payload and properties.

 

JavaScript
Edit|Remove
Payload: 
{"deviceid":93,"value":97} 
Properties: 
- Key=[deviceId] Value=[93] 
- Key=[value] Value=[97] 
- Key=[time] Value=[635398156544407695] 
- Key=[city] Value=[Milan] 
- Key=[country] Value=[Italy]

 

 

C#
Edit|Remove
namespace Microsoft.WindowsAzure.CAT.ServiceBusExplorer 
{ 
    public interface IEventDataInspector 
    { 
        EventData BeforeSendMessage(EventData eventData,  
                                    WriteToLogDelegate writeToLog = null); 
        EventData AfterReceiveMessage(EventData eventData,  
                                      WriteToLogDelegate writeToLog = null); 
    } 
}

 

 

XML
Edit|Remove
<?xml version="1.0" encoding="utf-8"?> 
<configuration  ... 
  <eventDataGenerators    <add key="OnOffDeviceEventDataGenerator"  
         value="Microsoft.WindowsAzure.CAT.ServiceBusExplorer.OnOffDeviceEventDataGenerator,ServiceBusExplorer" /> 
    <add key="ThresholdDeviceEventDataGenerator"  
         value="Microsoft.WindowsAzure.CAT.ServiceBusExplorer.ThresholdDeviceEventDataGenerator,ServiceBusExplorer" /> 
  </eventDataGenerators> 
  ... 
</configuration>

 

EventData inspectors can be selected under the following dialogs:

 

Update: 22 July 2014

This version introduces the following updates: