【问题标题】:Azure Cosmos Java SDK overriding default retry values?Azure Cosmos Java SDK 覆盖默认重试值?
【发布时间】:2021-01-06 18:13:16
【问题描述】:

我正在使用 Azure Cosmos SDK 版本 4.10.0。我想知道除了限制异常之外,有没有办法覆盖异常的重试值。我知道可以使用 ThrottlingRetryOptions 覆盖受限制的请求 (429)。

其他一些有重试的异常是

  1. 网络故障:最大重试次数 - 120
  2. GoneExceptions
  3. PartitionIsMigratingException

默认值:

Backoff Constants 

private final static int DEFAULT_WAIT_TIME_IN_SECONDS = 30;
//Note: Wait time in seconds after which the exception is logged with following warning: ""Received {} after backoff/retry. Will fail the request.{exception}". No further retries are attempted after this duration.
private final static int MAXIMUM_BACKOFF_TIME_IN_SECONDS = 15;
//Note: Maximum time in seconds a backoff occurs
private final static int INITIAL_BACKOFF_TIME = 1; // in seconds
private final static int BACK_OFF_MULTIPLIER = 2;

我们不希望我们的客户端由于网络问题等待 30 秒,然后在 5 秒后返回失败。

【问题讨论】:

  • 你想要一个函数来改变默认超时吗?如果是这样,this document 可以帮助你吗?
  • 我指的是下面的版本mvnrepository.com/artifact/com.azure/azure-cosmos/4.10.0这里有文档this只有一个Retry Class用于油门请求。
  • @Tiny-wa this one 相同的文件..但我认为这是最新的 SDK 版本。此文件中存在以下值private final static int DEFAULT_WAIT_TIME_IN_SECONDS = 30; private final static int MAXIMUM_BACKOFF_TIME_IN_SECONDS = 15; private final static int INITIAL_BACKOFF_TIME = 1; private final static int BACK_OFF_MULTIPLIER = 2; 我们可以覆盖这些吗?
  • 覆盖它,在本地启动程序并拔掉网线或断开无线网络,这是我可以考虑测试的。

标签: azure-cosmosdb


【解决方案1】:

Java SDK 关于请求超时和重试选项:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-12-20
    • 1970-01-01
    • 1970-01-01
    • 2017-07-08
    • 1970-01-01
    • 1970-01-01
    • 2020-06-07
    相关资源
    最近更新 更多