Azure cosmosdb ChangeFeed-上次成功处理的操作

Azure cosmosdb ChangeFeed-上次成功处理的操作,azure-cosmosdb,Azure Cosmosdb,下面的代码片段将迭代更改提要。如果我们需要跟踪最后一个成功处理的记录,则是由循环中的continuation plus索引(continuation+i)和/或文档的ETag计算的记录。如果出现故障,如何从该确切位置查询changefeed?不清楚,因为当我从0开始请求1000时,测试中的延续令牌是1120 IDocumentQuery < Document > query = client.CreateDocumentChangeFeedQuery( collectionUri,

下面的代码片段将迭代更改提要。如果我们需要跟踪最后一个成功处理的记录,则是由循环中的continuation plus索引(continuation+i)和/或文档的ETag计算的记录。如果出现故障,如何从该确切位置查询changefeed?不清楚,因为当我从0开始请求1000时,测试中的延续令牌是1120

IDocumentQuery < Document > query = client.CreateDocumentChangeFeedQuery(
 collectionUri,
 new ChangeFeedOptions {
  PartitionKeyRangeId = pkRange.Id,
   StartFromBeginning = true,
   RequestContinuation = continuation,
   MaxItemCount = 1000
 });

while (query.HasMoreResults) {

 Dictionary < string, BlastTimeRange > br = new Dictionary < string, BlastTimeRange > ();
 var readChangesResponse = query.ExecuteNextAsync < Document > ().Result;
 int i =0;
 foreach(Document changedDocument in readChangesResponse.AsEnumerable().ToList()) {
   // processing each one
   // the continuation and i represent the place or is it better to store off the ETag?  
 }
IDocumentQueryquery=client.CreateDocumentChangeFeedQuery(
collectionUri,
新的ChangeFeedOptions{
PartitionKeyRangeId=pkRange.Id,
startFromStart=真,
请求继续=继续,
MaxItemCount=1000
});
while(query.HasMoreResults){
字典br=新字典();
var readChangesResponse=query.ExecuteNextAsync().Result;
int i=0;
foreach(readChangesResponse.AsEnumerable().ToList()中的文档更改文档){
//处理每一个
//延续和我代表的地方,还是更好的存储了ETag?
}

}

现在最好的方法是跟踪continuation令牌(与RESTAPI中的
ETag
相同),以及批处理中读取的文档的
\u rid
值列表。读取下一批时,必须排除以前处理过的
\u rid

不编写自定义代码的最简单方法是使用DocumentDB团队的ChangeFeedProcessor库(在预览中)。为了获得访问权限。请发电子邮件askdocdb@microsoft.com.