Java Azure Cosmos:changeFeedProcessor:错误:必须为此操作提供PartitionKey值
我正在尝试Azure Cosmos的changeFeedProcessor SDK示例应用程序 回购的GIT链接: 已按以下方式配置了所有必需的属性 COSMOSDB_端点={hostandport} COSMOSDB_SECRET={secretKey} COSMOSDB_数据库={DBName} COSMOSDB_集合={CollectionName} COSMOSDB_AUX_COLLECTION={AuxCollectionName} COSMOSDB_LEASE_COLLECTION={LeaseCollectionName} 并在sample.java中提供了主机名 在方法DocumentLeaseServiceManager.initialize()中, documentServices.createDocument()操作成功,而documentServices.deleteDocument()失败,出现以下错误 java.lang.UnsupportedOperationException:PartitionKey值必须为 为该操作提供。在 com.microsoft.azure.documentdb.DocumentClient.addPartitionKeyInformation(DocumentClient.java:3346) 在 com.microsoft.azure.documentdb.DocumentClient.deleteDocument(DocumentClient.java:1047) 在 com.microsoft.azure.documentdb.changefeedprocessor.services.DocumentServices.deleteDocument(DocumentServices.java:248) 在 com.microsoft.azure.documentdb.changefeedprocessor.internal.documentleasestore.DocumentServiceLeaseManager.initialize(DocumentServiceLeaseManager.java:116) 在 com.microsoft.azure.documentdb.changefeedprocessor.ChangeFeedEventHost.initializeIntegrations(ChangeFeedEventHost.java:165) 在 com.microsoft.azure.documentdb.changefeedprocessor.ChangeFeedEventHost.start(ChangeFeedEventHost.java:143) 在 com.microsoft.azure.documentdb.changefeedprocessor.ChangeFeedEventHost.lambda$registerObserverFactory$0(ChangeFeedEventHost.java:133) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 运行(Thread.java:748)Java Azure Cosmos:changeFeedProcessor:错误:必须为此操作提供PartitionKey值,java,database,azure,azure-cosmosdb,Java,Database,Azure,Azure Cosmosdb,我正在尝试Azure Cosmos的changeFeedProcessor SDK示例应用程序 回购的GIT链接: 已按以下方式配置了所有必需的属性 COSMOSDB_端点={hostandport} COSMOSDB_SECRET={secretKey} COSMOSDB_数据库={DBName} COSMOSDB_集合={CollectionName} COSMOSDB_AUX_COLLECTION={AuxCollectionName} COSMOSDB_LEASE_COLLECTION
非常感谢您提供解决方案。该版本的Change Feed处理器似乎相当陈旧。这可能与分区租赁容器不兼容。如果租约集合已分区(分区键应为
/id
),请尝试已作为Java SDK一部分的更新的变更提要处理器
参考:
示例:谢谢Matias,这个很好用。解决了我的问题。顺便说一下……我需要从数据库的所有容器中观察changeFeed。有没有一种方法可以做到这一点,而不用创建单独的实例来观察单独的容器?没有,Change Feed仅在容器级别可用。