0

I'm looking to have clients subscribe to topics on an Azure service bus using an RSS Reader.

I can't seem to find documentation on how I would begin to produce the feeds dynamically from the service bus

Can anyone give me any pointers?

1 Answer 1

1

Service Bus produces an ATOM feed all by itself at the root of the namespace, which is called 'Service Registry". It sits at https://yournamespace.servicebus.windows.net and will quite likely show as empty when you go there with a browser.

To explore the namespace feed (which is a nested structure of ATOM feeds), you need to present a SAS token with "Manage" access for the root of the namespace in the "Authorization" or "ServiceBusAuthorization" header of the HTTP GET request. The standard "RootManageSharedAccessKey" rule has that right.

    class Program
    {
        static void Main(string[] args)
        {
            // for connection string: 
            // Endpoint=sb://[[yournamespace]].servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=[[key]]

             var tp = TokenProvider.CreateSharedAccessSignatureTokenProvider("RootManageSharedAccessKey", "[[key]]");
            var token = tp.GetWebTokenAsync("http://[[yournamespace]].servicebus.windows.net/", string.Empty, true, TimeSpan.FromHours(1))
                .GetAwaiter()
                .GetResult();
            Console.WriteLine(token);
        }
    }

Using the snippet above in a console app (using the SB NuGet package), you'll get the required token string to put into the HTTP header.

When I use that token in the HTTP "Authorization:" header with one of my namespaces in Fiddler's composer for a HTTPS GET on the root, I get

<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:f1ccc436-e5bb-47f7-b780-a7d06e942d51;id=843</id>
  <updated>2016-01-05T12:30:33Z</updated>
  <generator>Service Bus 1.1</generator>
  <entry>
    <id>uuid:f1ccc436-e5bb-47f7-b780-a7d06e942d51;id=844</id>
    <title type="text">democtrl</title>
    <updated>2016-01-05T12:30:34Z</updated>
    <link rel="alternate" href="http://clemensveu.servicebus.windows.net/democtrl"/>
  </entry>
  <entry>
    <id>uuid:f1ccc436-e5bb-47f7-b780-a7d06e942d51;id=845</id>
    <title type="text">hshsjsjshjshsjhsjhs</title>
    <updated>2016-01-05T12:30:34Z</updated>
    <link rel="alternate" href="http://clemensveu.servicebus.windows.net/hshsjsjshjshsjhsjhs"/>
  </entry>
  <entry>
    <id>uuid:f1ccc436-e5bb-47f7-b780-a7d06e942d51;id=846</id>
    <title type="text">iotev2</title>
    <updated>2016-01-05T12:30:34Z</updated>
    <link rel="alternate" href="http://clemensveu.servicebus.windows.net/iotev2"/>
  </entry>
  <entry>
    <id>uuid:f1ccc436-e5bb-47f7-b780-a7d06e942d51;id=847</id>
    <title type="text">samplequeue</title>
    <updated>2016-01-05T12:30:34Z</updated>
    <link rel="alternate" href="http://clemensveu.servicebus.windows.net/samplequeue"/>
  </entry>
  <entry>
    <id>uuid:f1ccc436-e5bb-47f7-b780-a7d06e942d51;id=848</id>
    <title type="text">stelemetryqueue</title>
    <updated>2016-01-05T12:30:34Z</updated>
    <link rel="alternate" href="http://clemensveu.servicebus.windows.net/stelemetryqueue"/>
  </entry>
  <entry>
    <id>uuid:f1ccc436-e5bb-47f7-b780-a7d06e942d51;id=849</id>
    <title type="text">testqueue</title>
    <updated>2016-01-05T12:30:34Z</updated>
    <link rel="alternate" href="http://clemensveu.servicebus.windows.net/testqueue"/>
  </entry>
</feed>

and when following the link for testqueue (but with HTTPS to protect the token), I get

<entry xmlns="http://www.w3.org/2005/Atom">
  <id>https://clemensveu.servicebus.windows.net/testqueue</id>
  <title type="text">testqueue</title>
  <published>2015-09-07T09:33:46Z</published>
  <updated>2015-09-07T09:34:17Z</updated>
  <author>
    <name>clemensveu</name>
  </author>
  <link rel="self" href="https://clemensveu.servicebus.windows.net/testqueue"/>
  <content type="application/xml">
    <QueueDescription xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      <LockDuration>PT30S</LockDuration>
      <MaxSizeInMegabytes>16384</MaxSizeInMegabytes>
      <RequiresDuplicateDetection>false</RequiresDuplicateDetection>
      <RequiresSession>false</RequiresSession>
      <DefaultMessageTimeToLive>P14D</DefaultMessageTimeToLive>
      <DeadLetteringOnMessageExpiration>false</DeadLetteringOnMessageExpiration>
      <DuplicateDetectionHistoryTimeWindow>PT10M</DuplicateDetectionHistoryTimeWindow>
      <MaxDeliveryCount>10</MaxDeliveryCount>
      <EnableBatchedOperations>true</EnableBatchedOperations>
      <SizeInBytes>1550</SizeInBytes>
      <MessageCount>5</MessageCount>
    </QueueDescription>
  </content>
</entry>
7
  • Excellent Answer, thank you. How would one go about adding that feed to an RSS/Atom reader? Commented Jan 6, 2016 at 16:04
  • That depends on what you mean with "RSS/Atom reader". Do you mean a framework abstraction such as the WCF syndication API? Commented Jan 7, 2016 at 14:06
  • Something like feedreader.com - I'm probably missing something in my understanding Commented Jan 7, 2016 at 15:08
  • ok, so my return from fiddler composer doesn't show any public feeds, but i have 1 queue and one topic type on there. all the return shows is: <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:db1b688d-0d5f-4a7b-8f76-276fb4f334a9;id=19017</id><updated>2016-01-11T16:08:55Z</updated><generator>Service Bus 1.1</generator></feed> Commented Jan 11, 2016 at 16:11
  • Did you create and add the token with a header as described? Commented Jan 11, 2016 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.