gpt4 book ai didi

java - azure 宇宙 : changeFeedProcessor: Error: PartitionKey value must be supplied for this operation

转载 作者:行者123 更新时间:2023-12-01 21:16:25 29 4
gpt4 key购买 nike

我正在尝试适用于 Azure-Cosmos 的 ChangeFeedProcessor SDK 示例应用程序。

仓库的 GIT 链接: https://github.com/Azure/azure-documentdb-changefeedprocessor-java

已配置所有必需的属性,如下所示

COSMOSDB_EN​​DPOINT={主机和端口}

COSMOSDB_SECRET={secretKey}

COSMOSDB_DATABASE={DBName}

COSMOSDB_COLLECTION={集合名称}

COSMOSDB_AUX_COLLECTION={AuxCollectionName}

COSMOSDB_LEASE_COLLECTION={LeaseCollectionName}

并在sample.java中提供主机名

在DocumentLeaseServiceManager.initialize()方法中,documentServices.createDocument() 操作成功,而 documentServices.deleteDocument() 失败并出现以下错误

java.lang.UnsupportedOperationException: PartitionKey value must be supplied for this operation. at com.microsoft.azure.documentdb.DocumentClient.addPartitionKeyInformation(DocumentClient.java:3346) at com.microsoft.azure.documentdb.DocumentClient.deleteDocument(DocumentClient.java:1047) at com.microsoft.azure.documentdb.changefeedprocessor.services.DocumentServices.deleteDocument(DocumentServices.java:248) at com.microsoft.azure.documentdb.changefeedprocessor.internal.documentleasestore.DocumentServiceLeaseManager.initialize(DocumentServiceLeaseManager.java:116) at com.microsoft.azure.documentdb.changefeedprocessor.ChangeFeedEventHost.initializeIntegrations(ChangeFeedEventHost.java:165) at com.microsoft.azure.documentdb.changefeedprocessor.ChangeFeedEventHost.start(ChangeFeedEventHost.java:143) at com.microsoft.azure.documentdb.changefeedprocessor.ChangeFeedEventHost.lambda$registerObserverFactory$0(ChangeFeedEventHost.java:133) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

非常感谢解决方案。

最佳答案

该版本的更改源处理器似乎相当旧。可能与分区的租赁容器不兼容。如果您的 Lease 集合已分区(分区键应为 /id),请尝试更新的 Change Feed Processor,该处理器已成为 Java SDK 的一部分。

引用:https://github.com/Azure/azure-cosmosdb-java/tree/v3

示例:https://github.com/Azure/azure-cosmosdb-java/tree/v3/examples/src/main/java/com/azure/data/cosmos/examples/ChangeFeed

关于java - azure 宇宙 : changeFeedProcessor: Error: PartitionKey value must be supplied for this operation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58870515/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com