我正在尝试从Windows Azure Service Bus中的“QueueDescription”中检索“AccessedAt”值。
通过.NET库检索它的代码如下所示:
TokenProvider credentials = TokenProvider.CreateSharedSecretTokenProvider("owner", "[SECRET]");
NamespaceManager namespaceClient = new NamespaceManager(new Uri("https://[NAMESPACE].servicebus.windows.net/"), credentials);
QueueDescription q = namespaceClient.GetQueue("[QUEUE]");
请注意,以上是HTTP通信。它应该和REST一样。 可以使用简单的REST接口执行相同的操作。请参阅本教程:http://msdn.microsoft.com/en-us/library/windowsazure/hh416754.aspx
但是当你使用REST时,你得到了这个输出:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<id>https://[NAMESPACE].windows.net/[QUEUE]</id>
<title type="text">[QUEUE]</title>
<published>2014-03-25T14:31:36Z</published>
<updated>2014-03-25T14:31:36Z</updated>
<author>
<name>[NAMESPACE]</name>
</author>
<link rel="self" href="https://[NAMESPACE].servicebus.windows.net/[QUEUE]" />
<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>PT1M</LockDuration>
<MaxSizeInMegabytes>1024</MaxSizeInMegabytes>
<RequiresDuplicateDetection>false</RequiresDuplicateDetection>
<RequiresSession>false</RequiresSession>
<DefaultMessageTimeToLive>P10675199DT2H48M5.4775807S</DefaultMessageTimeToLive>
<DeadLetteringOnMessageExpiration>false</DeadLetteringOnMessageExpiration>
<DuplicateDetectionHistoryTimeWindow>PT10M</DuplicateDetectionHistoryTimeWindow>
<MaxDeliveryCount>10</MaxDeliveryCount>
<EnableBatchedOperations>true</EnableBatchedOperations>
<SizeInBytes>0</SizeInBytes>
<MessageCount>0</MessageCount>
</QueueDescription>
</content>
</entry>
没有“AccessedAt”值。我找不到这两种方法的区别。 我在非PC上使用它。因此需要REST api。我已经尝试通过Microsoft.ServiceBus.dll来查看它是否是标题或缺少的东西。还有 添加了一些标题,但它们似乎没有什么区别。或许我找不到合适的人选。 (Microsoft.ServiceBus.dll不是很透明。)
任何人都知道如何通过REST获取“AccessedAt”值?
答案 0 :(得分:1)
Service Bus REST API有一个查询参数&#34; api-version&#34;,您可以尝试传入吗?api-version =&#34; 2014-01&#34;并看看是否能解决问题?