当使用高级的ChangeFeedProcessor时,是否不能设置ChangeFeedOptions(特别是PartitionKey和lease-prefix)? 那个库是不是太高级了?我用的是V3 Cosmos。 网上所有的例子都显示了V2的低级设置方式。这里是V3 ProcessorBuilder...。 我需要一个.options或.WithPartitionKey等。
ChangeFeedProcessor changeFeedProcessor = cosmosClient.GetContainer("myDB", "myContainer")
.GetChangeFeedProcessorBuilder<myData>("changeFeedTest", HandleChangesAsync)
.WithPollInterval(new TimeSpan(0, 0, 1))
.WithInstanceName("Host1" )
.WithLeaseContainer(leaseContainer)
.Build();
也许一个具体的例子会有帮助。
这里有另一种方法来问这个问题。 在这里的docs中的例子。https:/docs.microsoft.comen-usazurecosmos-dbchange-feed-processor。它们显示A-E城市进入一个主机处理器,但似乎没有API了,用GetChangeFeedProcessorBuilder来设置。
Changefeedprocessor(推送模型)确实不支持分区键(如下文文档链接中所指出的),答案是在3.9.0预览中的一个新的 "changefeed pull model "功能(仍然)。今天发布)。但在早期的3.9.0-preview3中。 它是否有效,我还不能评论。
https:/docs.microsoft.comen-usazurecosmos-dbchange-feed-pull-model)。
所以,你必须自己投票喂养和维护延续的代币。