# Documentation
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.
 
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.Azure.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.Azure.ServiceBusExplorer.OnOffDeviceBrokeredMessageGenerator,ServiceBusExplorer" /> 
    <add key="ThresholdDeviceBrokeredMessageGenerator"  
         value="Microsoft.Azure.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]

 

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.Azure.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.Azure.ServiceBusExplorer.LogBrokeredMessageInspector,ServiceBusExplorer" /> 
    <add key="ZipBrokeredMessageInspector"  
         value="Microsoft.Azure.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.Azure.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.Azure.ServiceBusExplorer.LogEventDataInspector,ServiceBusExplorer" /> 
    <add key="ZipEventDataInspector"  
         value="Microsoft.Azure.ServiceBusExplorer.ZipEventDataInspector,ServiceBusExplorer" /> 
  </eventDataInspectors> 
  ... 
</configuration>

 

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]

 

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.Azure.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.Azure.ServiceBusExplorer.OnOffDeviceEventDataGenerator,ServiceBusExplorer" /> 
    <add key="ThresholdDeviceEventDataGenerator"  
         value="Microsoft.Azure.ServiceBusExplorer.ThresholdDeviceEventDataGenerator,ServiceBusExplorer" /> 
  </eventDataGenerators> 
  ... 
</configuration>

 

EventData inspectors can be selected under the following dialogs:

Update: 22 July 2014

This version introduces the following updates:

Update: 19 September 2014

This version introduces the following updates:

 

Update: 22 September 2014

This version introduces the following updates:

Update: 4 December 2014

This version introduces the following updates:

JavaScript
Edit|Remove
[ 
  { 
    "namespace""eventhubs", 
    "eventHub""basicsampleeventhub", 
    "leases"{ 
      "0"{ 
        "PartitionId""0", 
        "Owner""ServiceBusExplorer", 
        "Token": null, 
        "Epoch"0, 
        "Offset""244712", 
        "SequenceNumber"1699 
      }, 
      "1"{ 
        "PartitionId""1", 
        "Owner""ServiceBusExplorer", 
        "Token": null, 
        "Epoch"0, 
        "Offset""127416", 
        "SequenceNumber"885 
      }, 
      "7"{ 
        "PartitionId""7", 
        "Owner""ServiceBusExplorer", 
        "Token": null, 
        "Epoch"0, 
        "Offset""335176", 
        "SequenceNumber"2327 
      }, 
      "2"{ 
        "PartitionId""2", 
        "Owner""ServiceBusExplorer", 
        "Token": null, 
        "Epoch"0, 
        "Offset""86152", 
        "SequenceNumber"599 
      }, 
      "4"{ 
        "PartitionId""4", 
        "Owner""ServiceBusExplorer", 
        "Token": null, 
        "Epoch"0, 
        "Offset""238264", 
        "SequenceNumber"1654 
      }, 
      "3"{ 
        "PartitionId""3", 
        "Owner""ServiceBusExplorer", 
        "Token": null, 
        "Epoch"0, 
        "Offset""-1", 
        "SequenceNumber"0 
      }, 
      "5"{ 
        "PartitionId""5", 
        "Owner""ServiceBusExplorer", 
        "Token": null, 
        "Epoch"0, 
        "Offset""-1", 
        "SequenceNumber"0 
      }, 
      "6"{ 
        "PartitionId""6", 
        "Owner""ServiceBusExplorer", 
        "Token": null, 
        "Epoch"0, 
        "Offset""-1", 
        "SequenceNumber"0 
      } 
    } 
  } 
]

 

Update: 18 December 2014

This version introduces the following updates:

Update: 2 March 2015

This version introduces the following updates:

Relay service definition

Relay service authorization rules 

Metric rule definition


Metrics data and charts

HandlePartitionControl

Consumer Group / Partition Listener 

Consumer Group / Partition Listener: Listener Tab

Consumer Group / Partition Listener: EventsTab

Consumer Group / Partition Listener

Event Hub: metric rule definition

Event Hub: metric data and charts


Consumer Group: metric rule definition

Consumer Group:  metric data and charts

Notification Hub: metric rule definition

Notification Hub: metric data and charts

Relay: metric rule definition

 

Relay: metric data and charts

Namespace: metric rule definition

Namespace: metric data and charts

Update: 3 March 2015

This version introduces the following updates:

Update: 10 March 2015

This version introduces the following updates:

Update: 27 April 2015

This version introduces the following updates:

Update: 9 September 2015

This version introduces the following updates:

 

 

 

Update: 10 September 2015

This version introduces the following updates:

Update: 14 September 2015

This version introduces the following updates:

Update: 21 September 2015

This version introduces the following updates:

Update: 6 October 2015

This version introduces the following updates:

Update: 8 October 2015

This version introduces the following updates: