Change Feed in multi-region Azure Cosmos DB

2019-06-14 09:00发布

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条回答
我命由我不由天
2楼-- · 2019-06-14 09:32

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();
查看更多
登录 后发表回答