簡體   English   中英

如何在Cosmos DB Change Feed處理器中為RegisterObserverFactoryAsync函數提供PartitionKey?

[英]How do I supply PartitionKey for RegisterObserverFactoryAsync function in Cosmos DB Change Feed processor?

我正在路徑https://github.com/Azure/azure-documentdb-dotnet/tree/master/samples/ChangeFeedMigrationTool中運行Change Feed Processor示例。 我只更改了App.config文件中所需的鍵值以指向我的Cosmos DB。

當我針對分區集合運行此示例時,我在注冊觀察者工廠時遇到異常。

await host.RegisterObserverFactoryAsync(docObserverFactory);

例外細節:

InvalidOperationException: PartitionKey value must be supplied for this operation.

   at Microsoft.Azure.Documents.Client.DocumentClient.<AddPartitionKeyInformationAsync>d__34f.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
...
at ChangeFeedMigrationSample.Program.<RunChangeFeedHostAsync>d__18.MoveNext() in D:\temp\samples\code-samples\ChangeFeedProcessor\Program.cs:line 181
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at ChangeFeedMigrationSample.Program.<MainAsync>d__16.MoveNext() in D:\temp\samples\code-samples\ChangeFeedProcessor\Program.cs:line 92

但該函數不接受任何分區鍵。 而且我不知道如何通過一個。 我錯過了什么嗎? 另外,我的理解是Cosmos DB Change Feed Processor庫隱式管理所有分區。

租賃集合是否已分區? 目前不支持分區租約集合(應該很快),並且錯誤消息將是這樣的。 您可以嘗試使用單分區租約收集。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM