Consul Retry
如果您预计在应用程序启动时 consul 代理可能会偶尔不可用,则可以要求其在发生故障后继续尝试。您需要将 spring-retry
和 spring-boot-starter-aop
添加到您的类路径。默认行为是重试 6 次,初始退避间隔为 1000ms,后续退避的指数乘数为 1.1。您可以使用 spring.cloud.consul.retry.*
配置属性配置这些属性(和其他属性)。这适用于 Spring Cloud Consul Config 和 Discovery 注册。
If you expect that the consul agent may occasionally be unavailable when
your app starts, you can ask it to keep trying after a failure. You need to add
spring-retry
and spring-boot-starter-aop
to your classpath. The default
behaviour is to retry 6 times with an initial backoff interval of 1000ms and an
exponential multiplier of 1.1 for subsequent backoffs. You can configure these
properties (and others) using spring.cloud.consul.retry.*
configuration properties.
This works with both Spring Cloud Consul Config and Discovery registration.
要完全控制重试,请添加 id 为“consulRetryInterceptor”的 |
To take full control of the retry add a |