Cosmos DB:如何使用 TransactionalBatch 重试失败
Cosmos DB: How to retry failures with TransactionalBatch
我在 Cosmos DB
中有一些存储过程,我想将其转换为 .NET 事务。最近,我看到这个 post https://devblogs.microsoft.com/cosmosdb/introducing-transactionalbatch-in-the-net-sdk/ 讨论了事务支持。我也能够测试它,它似乎工作正常。
我知道 .NET 已将内置重试逻辑添加到其支持的许多包中。 TransactionalBatch
是否有任何内置的重试策略?重试任何失败的推荐方法是什么?上面的post在看IsSuccessStatusCode
。我们应该在状态失败后重试吗?
Does TransactionalBatch have any built-in retry policy?
暂时不支持built-in重试策略。
What is the recommended approach to retrying any failures?
TransactionalBatch 描述了一组需要成功或失败的点操作。如果任何操作失败,则回滚整个事务。
因为失败的状态码是424和409,所以我们不能使用RetryOptions.MaxRetryAttemptsOnThrottledRequests
。
因此,您可以使用 for (int i = 0; i < MaxRetries; i++){}
来执行重试逻辑。
我在 Cosmos DB
中有一些存储过程,我想将其转换为 .NET 事务。最近,我看到这个 post https://devblogs.microsoft.com/cosmosdb/introducing-transactionalbatch-in-the-net-sdk/ 讨论了事务支持。我也能够测试它,它似乎工作正常。
我知道 .NET 已将内置重试逻辑添加到其支持的许多包中。 TransactionalBatch
是否有任何内置的重试策略?重试任何失败的推荐方法是什么?上面的post在看IsSuccessStatusCode
。我们应该在状态失败后重试吗?
Does TransactionalBatch have any built-in retry policy?
暂时不支持built-in重试策略。
What is the recommended approach to retrying any failures?
TransactionalBatch 描述了一组需要成功或失败的点操作。如果任何操作失败,则回滚整个事务。
因为失败的状态码是424和409,所以我们不能使用RetryOptions.MaxRetryAttemptsOnThrottledRequests
。
因此,您可以使用 for (int i = 0; i < MaxRetries; i++){}
来执行重试逻辑。