DocumentDB TransientFaultHandling for Core

Bil*_*oel 4 asp.net-core azure-cosmosdb

我正在尝试将我的代码迁移到Core.

我使用的是DocumentDB TransientFaultHandling软件包,但我似乎无法为Core库找到它.

是否仍然是使用它的最佳做法,还是有其他选择来实现相同的结果?

TIA

Mat*_*nta 6

当前的SDK(Core和Full Framework)已经包含了作为TransientFaultHandling包的一部分的故障处理,由于您无法定义指数逻辑,因此它不完全相同,但它适用于最常见的方案.

它在ConnectionPolicy设置上:

var _dbClient = new DocumentClient("Db_uri", "Db_key", new ConnectionPolicy()
{
    MaxConnectionLimit=100,
    ConnectionMode = ConnectionMode.Direct,
    ConnectionProtocol = Protocol.Tcp,
    RetryOptions = new RetryOptions() { MaxRetryAttemptsOnThrottledRequests=3, MaxRetryWaitTimeInSeconds=60 }
}); 
Run Code Online (Sandbox Code Playgroud)