0

是否可以在 dropwizard 中使用 spring-retry?或者,为此,在 dropwizard 中是否有类似 spring-retry 的东西?

4

2 回答 2

0

来自Spring Batch - 参考文档9. 重试

自 2.2.0 起,重试功能已从 Spring Batch 中移除。它现在是新库 Spring Retry 的一部分。

Spring Retry可以独立于其他 Spring 项目使用。

例如,在 Maven 项目中,您只需在 POM 中添加以下内容:

<dependency>
    <groupId>org.springframework.retry</groupId>
    <artifactId>spring-retry</artifactId>
    <version>1.1.5.RELEASE</version>
</dependency>
于 2017-02-06T14:23:58.103 回答
0

不确定弹簧重试会做什么,但对于客户端重试,您可以retries配置HttpClient

httpClient:
  timeout: 500ms
  retries: 3

重试失败请求的次数。只有在抛出除 、 、 或 之外的异常时,才会InterruptedIOExceptionUnknownHostExceptionConnectException请求SSLException

请参阅Dropwizard 文档

于 2017-02-05T13:55:41.097 回答