Change Feed in multi-region Azure Cosmos DB

穿精又带淫゛_ 提交于 2020-01-03 04:51:14

问题


I am using Cosmos DB multi-region (single region write) account. Currently it is enabled in East US and West US. The write region is West US.

The Change Feed listeners are deployed in both East US and West US. I wanted to understand, if I can specify that the listeners deployed in East US reads Change Feed from East US and listeners in West US reads Change Feed from West US. Or all the listeners will always read Change Feed from write region?


回答1:


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();


来源:https://stackoverflow.com/questions/55777776/change-feed-in-multi-region-azure-cosmos-db

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!