我正在路径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库隐式管理所有分区。
答案 0 :(得分:3)
租约收集是否已分区?目前不支持分区租约集合(应该很快),并且错误消息将是这样的。您可以尝试使用单分区租约收集。