且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在多区域Azure Cosmos DB中更改Feed

更新时间:2023-02-14 11:36:40

您当然可以使您的听众从最近的区域进行读取,这将改善您的延迟.您可以使用

You can certainly make your listeners read from the closest region, which should improve your latency. You can use the PreferredLocations attribute to customize that:

var localPolicy = new ConnectionPolicy();
localPolicy.PreferredLocations.Add("East US");

// Builder initialization
.WithFeedCollection(new DocumentCollectionInfo()
{
    DatabaseName = DbName,
    Uri = new Uri(uri),
    CollectionName = feedCollection,
    MasterKey = key,
    ConnectionPolicy = localPolicy
})
.BuildAsync();