Azure SDK中是否有任何RetryPolicy可以自动处理继续令牌?
对于查询,有时我会得到延续令牌,我想知道是否有针对 TableServiceContext
的 RetryPolicy 设置来自动处理令牌。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
对于查询,有时我会得到延续令牌,我想知道是否有针对 TableServiceContext
的 RetryPolicy 设置来自动处理令牌。
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
您不需要为此使用 RetryPolicy。有两个选项:
在查询中使用 .AsTableServiceQuery()。这会将您的查询转换为 CloudTableQuery<>对象,它本机处理延续标记。这是最简单的路线。例如:
否则您可以使用 Begin/EndExecuteSegmented() 并自己处理令牌。
对 CloudTableQuery 的说明<>
有一个对 CloudTableQuery<> 行为的间接引用。在 Scott Densmore 的博客上。但我还整理了以下相当混乱的代码来证明这一点。测试通过,并且它确实使用延续令牌来检索所有插入的实体。如果您使用 HTTP,您可以使用 Fiddler 进行观察,并看到令牌来回变化。
You don't need to use a RetryPolicy for that. There are two options:
Use .AsTableServiceQuery() on your queries. That converts your query into a CloudTableQuery<> object, which natively handles continuation tokens. This is the easiest route. eg:
Otherwise you can use Begin/EndExecuteSegmented() and handle the tokens yourself.
Clarification on CloudTableQuery<>
There's an oblique reference to the behavior of CloudTableQuery<> on Scott Densmore's blog. But I also threw together the following, rather messy, code to prove it. The tests pass, and it does use continuation tokens to retrieve all the inserted entities. If you use HTTP, you can watch it with Fiddler and see the tokens go back and forth.
查看http://blogs.msdn.com/b/windowsazurestorage/archive/2010/07/09/understanding-windows-azure-storage-billing-bandwidth-transactions-and-capacity.aspx 文中提到:
另外http://blogs.msdn.com/b/jimoneil/archive/2010/10/05/azure-home-part-7-asynchronous-table-storage-pagination.aspx 和http://scottdensmore.typepad.com/blog/2010/04/paging-with-windows-azure-table-storage.html
check out http://blogs.msdn.com/b/windowsazurestorage/archive/2010/07/09/understanding-windows-azure-storage-billing-bandwidth-transactions-and-capacity.aspx within the text it mentions:
Also http://blogs.msdn.com/b/jimoneil/archive/2010/10/05/azure-home-part-7-asynchronous-table-storage-pagination.aspx and http://scottdensmore.typepad.com/blog/2010/04/paging-with-windows-azure-table-storage.html