Service (Bus) Browser

I’ve put together a little tool to help with some development work I am doing. While Azure and .NET Services are still in CTP the tooling is a bit limited so, what with necessity being the mother of invention and all that, I’ve spent an afternoon hacking together my Service(Bus)Browser.

Basically, all the endpoints you create in a .NET Services solution – routers, queues, relay endpoints etc – are all listed in the service registry which is exposed as an Atom feed at the base URL of your solution. So, if you create a solution called “MySolution”, your registry root is at https://mysolution.servicesbus.windows.net. Point your favourite web browser at it and you’ll see what I mean.

However, only endpoints whose discoverability policy is set to public will appear unless you also submit the correct credentials when requesting the Atom feed. Here’s an example :

<feed xmlns="http://www.w3.org/2005/Atom">
        <title type="text">Publicly Listed Services</title>
        <subtitle type="text">This is the list of publicly-listed services currently available</subtitle>
        <id>uuid:6bbbd412-81e8-4f30-8629-909d8175e05a;id=558</id>
        <updated>2009-08-05T21:08:29Z</updated>
        <generator>Microsoft .NET Services - Service Bus</generator>
        <entry>
            <id>uuid:f661ac5a-e633-46b7-9d2a-845676c92c82;id=43</id>
            <title type="text">rest</title>
            <updated>2009-08-07T23:06:20Z</updated>
            <link rel="alternate" href="https://mysolution.servicebus.windows.net/rest/"/>
            <link rel="self" href="https://mysolution.servicebus.windows.net/rest/"/>
        </entry>
        <entry>
            <id>uuid:6bbbd412-81e8-4f30-8629-909d8175e05a;id=559</id>
            <title type="text">testqueues</title>
            <updated>2009-08-05T21:08:29Z</updated>
            <link rel="alternate" href="https://mysolution.servicebus.windows.net/testqueues/" />
            <link rel="self" href="https://mysolution.servicebus.windows.net/testqueues/" />
        </entry>
        <entry>
            <id>uuid:6bbbd412-81e8-4f30-8629-909d8175e05a;id=560</id>
            <title type="text">testrouters</title>
            <updated>2009-08-05T21:08:29Z</updated>
            <link rel="alternate" href="https://mysolution.servicebus.windows.net/testrouters/" />
            <link rel="self" href="https://mysolution.servicebus.windows.net/testrouters/" />
        </entry>
    </feed>

We can see three entries in the feed each denoting a node in the registry. Submitting a similar request to the URL of a node will retrieve the Atom feed of its child nodes and so on. Here’s the Atom feed for the testrouters node :

<feed xmlns="http://www.w3.org/2005/Atom">
    <title type="text">Publicly Listed Services</title>
    <subtitle type="text">This is the list of publicly-listed services currently available</subtitle>
    <id>uuid:11e6ffbf-1463-46e5-9a3a-61b7f0966af0;id=349</id>
    <updated>2009-08-08T08:31:00Z</updated>
    <generator>Microsoft® .NET Services - Service Bus</generator>
    <entry>
        <id>uuid:11e6ffbf-1463-46e5-9a3a-61b7f0966af0;id=350</id>
        <title type="text">5922fd42-6120-44cd-b07a-c3a36bd70168</title>
        <updated>2009-08-08T08:31:00Z</updated>
        <link rel="alternate" href="https://mysolution.servicebus.windows.net/TestRouters/5922fd42-6120-44cd-b07a-c3a36bd70168" />
        <link rel="self" href="https://mysolution.servicebus.windows.net/TestRouters/5922fd42-6120-44cd-b07a-c3a36bd70168!(router)" />
        <link rel="subscriptions" href="https://mysolution.servicebus.windows.net/TestRouters/5922fd42-6120-44cd-b07a-c3a36bd70168!(router/subscriptions)" />
        <RouterPolicy xmlns="http://schemas.microsoft.com/netservices/2009/05/servicebus/connect" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <Authorization>Required</Authorization>
            <Discoverability>Managers</Discoverability>
            <ExpirationInstant>2009-08-08T08:50:14.9579043Z</ExpirationInstant>
            <TransportProtection>AllPaths</TransportProtection>
            <MaxMessageSize>61440</MaxMessageSize>
            <BufferTimeout>PT10S</BufferTimeout>
            <MaxBufferLength>0</MaxBufferLength>
            <MaxBufferCapacity>0</MaxBufferCapacity>
            <MaxSubscribers>50</MaxSubscribers>
            <MessageDistribution>AllSubscribers</MessageDistribution>
            <PushDeliveryRetries>3</PushDeliveryRetries>
            <PushDeliveryTimeout>PT30S</PushDeliveryTimeout>
        </RouterPolicy>
    </entry>
</feed>

That’s the entry for a router along with an Atom extension element describing the router policy.

Here’s the UI. It’s basically a TreeView for the registry nodes, a PropertyGrid for the node properties and a RichTextBox for the raw Atom.

Service Browser UI

Currently it will manage multiple solutions, walk the Atom tree, display the nodes and their properties, policies and subscriptions. It also allows you to delete queues and routers. Next steps, when I get a bit more time, are to fix the subscription display for the router nodes and to allow the creation of routers and queues (and perhaps subscriptions). Current impediments, other than time, are that the Atom feed to the subscription URL on a router always seems to come back empty even when there are subscriptions 😦

You can download the source here. Feedback and comments welcome unless they are a 17 page treatise on why I should have used [insert your favourite UI stack here] and the [insert your favourite pattern here] pattern 🙂

Please note : Since I wrote this article and posted the code there have been a number of changes to .NET Services, the Service Bus and the Access Control Service, most notably in the November CTP where, amongst other things, we lost Routers and Queues. As a result this code will no longer work. I am working on an updated solution that demonstrates the same functionality which I will post as soon as it’s ready.
Advertisements

One Response to Service (Bus) Browser

  1. Jamie says:

    you da man!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: