【发布时间】:2015-12-23 15:59:43
【问题描述】:
我希望客户使用 RSS 阅读器订阅 Azure 服务总线上的主题。
我似乎找不到关于如何开始从服务总线动态生成提要的文档
谁能给我指点?
【问题讨论】:
标签: azure rss azureservicebus syndication azure-servicebus-topics
我希望客户使用 RSS 阅读器订阅 Azure 服务总线上的主题。
我似乎找不到关于如何开始从服务总线动态生成提要的文档
谁能给我指点?
【问题讨论】:
标签: azure rss azureservicebus syndication azure-servicebus-topics
Service Bus 在命名空间的根目录中自行生成一个 ATOM 提要,称为“服务注册表”。它位于 https://yournamespace.servicebus.windows.net,当您使用浏览器访问该位置时,很可能会显示为空。
要探索命名空间提要(ATOM 提要的嵌套结构),您需要在 HTTP GET 请求的“Authorization”或“ServiceBusAuthorization”标头中为命名空间的根提供SAS token with "Manage" access。标准的“RootManageSharedAccessKey”规则具有该权利。
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);
}
}
在控制台应用程序中使用上面的 sn-p(使用 SB NuGet 包),您将获得所需的令牌字符串以放入 HTTP 标头中。
当我在 HTTP "Authorization:" 标头中使用该令牌和我在 Fiddler 的作曲家中的一个命名空间在根上的 HTTPS 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>
当关注 testqueue 的链接时(但使用 HTTPS 来保护令牌),我得到了
<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>
【讨论】:
<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>