11 lines
3.3 KiB
HTML
11 lines
3.3 KiB
HTML
<html><head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>70. Consul Retry</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud.html" title="Spring Cloud"><link rel="up" href="multi__spring_cloud_consul.html" title="Part IX. Spring Cloud Consul"><link rel="prev" href="multi_spring-cloud-consul-config.html" title="69. Distributed Configuration with Consul"><link rel="next" href="multi_spring-cloud-consul-bus.html" title="71. Spring Cloud Bus with Consul"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">70. Consul Retry</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi_spring-cloud-consul-config.html">Prev</a> </td><th width="60%" align="center">Part IX. Spring Cloud Consul</th><td width="20%" align="right"> <a accesskey="n" href="multi_spring-cloud-consul-bus.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="spring-cloud-consul-retry" href="#spring-cloud-consul-retry"></a>70. Consul Retry</h2></div></div></div><p>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
|
|
<code class="literal">spring-retry</code> and <code class="literal">spring-boot-starter-aop</code> 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 <code class="literal">spring.cloud.consul.retry.*</code> configuration properties.
|
|
This works with both Spring Cloud Consul Config and Discovery registration.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>To take full control of the retry add a <code class="literal">@Bean</code> of type
|
|
<code class="literal">RetryOperationsInterceptor</code> with id "consulRetryInterceptor". Spring
|
|
Retry has a <code class="literal">RetryInterceptorBuilder</code> that makes it easy to create one.</p></td></tr></table></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi_spring-cloud-consul-config.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="multi__spring_cloud_consul.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="multi_spring-cloud-consul-bus.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">69. Distributed Configuration with Consul </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud.html">Home</a></td><td width="40%" align="right" valign="top"> 71. Spring Cloud Bus with Consul</td></tr></table></div></body></html> |