Sync docs from master to gh-pages
This commit is contained in:
@@ -12,7 +12,7 @@ config/application/</pre><p>The most specific property source is at the top, wit
|
||||
prefix: configuration
|
||||
defaultContext: apps
|
||||
profileSeparator: '::'</pre><p>
|
||||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">enabled</code> setting this value to "false" disables Consul Config</li><li class="listitem"><code class="literal">prefix</code> sets the base folder for configuration values</li><li class="listitem"><code class="literal">defaultContext</code> sets the folder name used by all applications</li><li class="listitem"><code class="literal">profileSeparator</code> sets the value of the separator used to separate the profile name in property sources with profiles</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="spring-cloud-consul-config-watch" href="#spring-cloud-consul-config-watch"></a>4.3 Config Watch</h2></div></div></div><p>The Consul Config Watch takes advantage of the ability of consul to <a class="link" href="https://www.consul.io/docs/agent/watches.html#keyprefix" target="_top">watch a key prefix</a>. The Config Watch makes a blocking Consul HTTP API call to determine if any relevant configuration data has changed for the current application. If there is new configuration data a Refresh Event is published. This is equivalent to calling the <code class="literal">/refresh</code> actuator endpoint.</p><p>To change the frequency of when the Config Watch is called change <code class="literal">spring.cloud.consul.config.watch.delay</code>. The default value is 1000, which is in milliseconds.</p><p>To disable the Config Watch set <code class="literal">spring.cloud.consul.config.watch.enabled=false</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="spring-cloud-consul-config-format" href="#spring-cloud-consul-config-format"></a>4.4 YAML or Properties with Config</h2></div></div></div><p>It may be more convenient to store a blob of properties in YAML or Properties format as opposed to individual key/value pairs. Set the <code class="literal">spring.cloud.consul.config.format</code> property to <code class="literal">YAML</code> or <code class="literal">PROPERTIES</code>. For example to use YAML:</p><p><b>bootstrap.yml. </b>
|
||||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">enabled</code> setting this value to "false" disables Consul Config</li><li class="listitem"><code class="literal">prefix</code> sets the base folder for configuration values</li><li class="listitem"><code class="literal">defaultContext</code> sets the folder name used by all applications</li><li class="listitem"><code class="literal">profileSeparator</code> sets the value of the separator used to separate the profile name in property sources with profiles</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="spring-cloud-consul-config-watch" href="#spring-cloud-consul-config-watch"></a>4.3 Config Watch</h2></div></div></div><p>The Consul Config Watch takes advantage of the ability of consul to <a class="link" href="https://www.consul.io/docs/agent/watches.html#keyprefix" target="_top">watch a key prefix</a>. The Config Watch makes a blocking Consul HTTP API call to determine if any relevant configuration data has changed for the current application. If there is new configuration data a Refresh Event is published. This is equivalent to calling the <code class="literal">/refresh</code> actuator endpoint.</p><p>To change the frequency of when the Config Watch is called change <code class="literal">spring.cloud.consul.config.watch.delay</code>. The default value is 1000, which is in milliseconds. The delay is the amount of time after the end of the previous invocation and the start of the next.</p><p>To disable the Config Watch set <code class="literal">spring.cloud.consul.config.watch.enabled=false</code>.</p><p>The watch uses a Spring <code class="literal">TaskScheduler</code> to schedule the call to consul. By default it is a <code class="literal">ThreadPoolTaskScheduler</code> with a <code class="literal">poolSize</code> of 1. To change the <code class="literal">TaskScheduler</code>, create a bean of type <code class="literal">TaskScheduler</code> named with the <code class="literal">ConsulConfigAutoConfiguration.CONFIG_WATCH_TASK_SCHEDULER_NAME</code> constant.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="spring-cloud-consul-config-format" href="#spring-cloud-consul-config-format"></a>4.4 YAML or Properties with Config</h2></div></div></div><p>It may be more convenient to store a blob of properties in YAML or Properties format as opposed to individual key/value pairs. Set the <code class="literal">spring.cloud.consul.config.format</code> property to <code class="literal">YAML</code> or <code class="literal">PROPERTIES</code>. For example to use YAML:</p><p><b>bootstrap.yml. </b>
|
||||
</p><pre class="screen">spring:
|
||||
cloud:
|
||||
consul:
|
||||
|
||||
@@ -59,4 +59,4 @@ public String serviceUrl() {
|
||||
return list.get(0).getUri();
|
||||
}
|
||||
return null;
|
||||
}</pre></div></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-agent.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi_spring-cloud-consul-config.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2. Consul Agent </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-consul.html">Home</a></td><td width="40%" align="right" valign="top"> 4. Distributed Configuration with Consul</td></tr></table></div></body></html>
|
||||
}</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_consul_catalog_watch" href="#_consul_catalog_watch"></a>3.5 Consul Catalog Watch</h2></div></div></div><p>The Consul Catalog Watch takes advantage of the ability of consul to <a class="link" href="https://www.consul.io/docs/agent/watches.html#services" target="_top">watch services</a>. The Catalog Watch makes a blocking Consul HTTP API call to determine if any services have changed. If there is new service data a Heartbeat Event is published.</p><p>To change the frequency of when the Config Watch is called change <code class="literal">spring.cloud.consul.config.discovery.catalog-services-watch-delay</code>. The default value is 1000, which is in milliseconds. The delay is the amount of time after the end of the previous invocation and the start of the next.</p><p>To disable the Catalog Watch set <code class="literal">spring.cloud.consul.discovery.catalog-services-watch.enabled=false</code>.</p><p>The watch uses a Spring <code class="literal">TaskScheduler</code> to schedule the call to consul. By default it is a <code class="literal">ThreadPoolTaskScheduler</code> with a <code class="literal">poolSize</code> of 1. To change the <code class="literal">TaskScheduler</code>, create a bean of type <code class="literal">TaskScheduler</code> named with the <code class="literal">ConsulDiscoveryClientConfiguration.CATALOG_WATCH_TASK_SCHEDULER_NAME</code> constant.</p></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-agent.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi_spring-cloud-consul-config.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2. Consul Agent </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-consul.html">Home</a></td><td width="40%" align="right" valign="top"> 4. Distributed Configuration with Consul</td></tr></table></div></body></html>
|
||||
@@ -1,3 +1,3 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Spring Cloud Consul</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-consul.html" title="Spring Cloud Consul"><link rel="next" href="multi_pr01.html" title=""></head><body class="firstpage" 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">Spring Cloud Consul</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi_pr01.html">Next</a></td></tr></table><hr></div><div lang="en" class="book"><div class="titlepage"><div><div><h1 class="title"><a name="d0e3"></a>Spring Cloud Consul</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="preface"><a href="multi_pr01.html"></a></span></dt><dt><span class="chapter"><a href="multi_spring-cloud-consul-install.html">1. Install Consul</a></span></dt><dt><span class="chapter"><a href="multi_spring-cloud-consul-agent.html">2. Consul Agent</a></span></dt><dt><span class="chapter"><a href="multi_spring-cloud-consul-discovery.html">3. Service Discovery with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_how_to_activate">3.1. How to activate</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_registering_with_consul">3.2. Registering with Consul</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_http_health_check">3.3. HTTP Health Check</a></span></dt><dd><dl><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_metadata_and_consul_tags">3.3.1. Metadata and Consul tags</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_making_the_consul_instance_id_unique">3.3.2. Making the Consul Instance ID Unique</a></span></dt></dl></dd><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_looking_up_services">3.4. Looking up services</a></span></dt><dd><dl><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_using_ribbon">3.4.1. Using Ribbon</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_using_the_discoveryclient">3.4.2. Using the DiscoveryClient</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="multi_spring-cloud-consul-config.html">4. Distributed Configuration with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="multi_spring-cloud-consul-config.html#_how_to_activate_2">4.1. How to activate</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-config.html#_customizing">4.2. Customizing</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-config.html#spring-cloud-consul-config-watch">4.3. Config Watch</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-config.html#spring-cloud-consul-config-format">4.4. YAML or Properties with Config</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-config.html#spring-cloud-consul-config-git2consul">4.5. git2consul with Config</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-config.html#spring-cloud-consul-failfast">4.6. Fail Fast</a></span></dt></dl></dd><dt><span class="chapter"><a href="multi_spring-cloud-consul-retry.html">5. Consul Retry</a></span></dt><dt><span class="chapter"><a href="multi_spring-cloud-consul-bus.html">6. Spring Cloud Bus with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="multi_spring-cloud-consul-bus.html#_how_to_activate_3">6.1. How to activate</a></span></dt></dl></dd><dt><span class="chapter"><a href="multi_spring-cloud-consul-hystrix.html">7. Circuit Breaker with Hystrix</a></span></dt><dt><span class="chapter"><a href="multi_spring-cloud-consul-turbine.html">8. Hystrix metrics aggregation with Turbine and Consul</a></span></dt></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi_pr01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
|
||||
<title>Spring Cloud Consul</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-consul.html" title="Spring Cloud Consul"><link rel="next" href="multi_pr01.html" title=""></head><body class="firstpage" 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">Spring Cloud Consul</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi_pr01.html">Next</a></td></tr></table><hr></div><div lang="en" class="book"><div class="titlepage"><div><div><h1 class="title"><a name="d0e3"></a>Spring Cloud Consul</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="preface"><a href="multi_pr01.html"></a></span></dt><dt><span class="chapter"><a href="multi_spring-cloud-consul-install.html">1. Install Consul</a></span></dt><dt><span class="chapter"><a href="multi_spring-cloud-consul-agent.html">2. Consul Agent</a></span></dt><dt><span class="chapter"><a href="multi_spring-cloud-consul-discovery.html">3. Service Discovery with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_how_to_activate">3.1. How to activate</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_registering_with_consul">3.2. Registering with Consul</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_http_health_check">3.3. HTTP Health Check</a></span></dt><dd><dl><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_metadata_and_consul_tags">3.3.1. Metadata and Consul tags</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_making_the_consul_instance_id_unique">3.3.2. Making the Consul Instance ID Unique</a></span></dt></dl></dd><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_looking_up_services">3.4. Looking up services</a></span></dt><dd><dl><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_using_ribbon">3.4.1. Using Ribbon</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_using_the_discoveryclient">3.4.2. Using the DiscoveryClient</a></span></dt></dl></dd><dt><span class="section"><a href="multi_spring-cloud-consul-discovery.html#_consul_catalog_watch">3.5. Consul Catalog Watch</a></span></dt></dl></dd><dt><span class="chapter"><a href="multi_spring-cloud-consul-config.html">4. Distributed Configuration with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="multi_spring-cloud-consul-config.html#_how_to_activate_2">4.1. How to activate</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-config.html#_customizing">4.2. Customizing</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-config.html#spring-cloud-consul-config-watch">4.3. Config Watch</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-config.html#spring-cloud-consul-config-format">4.4. YAML or Properties with Config</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-config.html#spring-cloud-consul-config-git2consul">4.5. git2consul with Config</a></span></dt><dt><span class="section"><a href="multi_spring-cloud-consul-config.html#spring-cloud-consul-failfast">4.6. Fail Fast</a></span></dt></dl></dd><dt><span class="chapter"><a href="multi_spring-cloud-consul-retry.html">5. Consul Retry</a></span></dt><dt><span class="chapter"><a href="multi_spring-cloud-consul-bus.html">6. Spring Cloud Bus with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="multi_spring-cloud-consul-bus.html#_how_to_activate_3">6.1. How to activate</a></span></dt></dl></dd><dt><span class="chapter"><a href="multi_spring-cloud-consul-hystrix.html">7. Circuit Breaker with Hystrix</a></span></dt><dt><span class="chapter"><a href="multi_spring-cloud-consul-turbine.html">8. Hystrix metrics aggregation with Turbine and Consul</a></span></dt></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi_pr01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
|
||||
@@ -1,6 +1,6 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Spring Cloud Consul</title><link rel="stylesheet" type="text/css" href="css/manual-singlepage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div lang="en" class="book"><div class="titlepage"><div><div><h1 class="title"><a name="d0e3"></a>Spring Cloud Consul</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="preface"><a href="#d0e9"></a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-install">1. Install Consul</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-agent">2. Consul Agent</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-discovery">3. Service Discovery with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_how_to_activate">3.1. How to activate</a></span></dt><dt><span class="section"><a href="#_registering_with_consul">3.2. Registering with Consul</a></span></dt><dt><span class="section"><a href="#_http_health_check">3.3. HTTP Health Check</a></span></dt><dd><dl><dt><span class="section"><a href="#_metadata_and_consul_tags">3.3.1. Metadata and Consul tags</a></span></dt><dt><span class="section"><a href="#_making_the_consul_instance_id_unique">3.3.2. Making the Consul Instance ID Unique</a></span></dt></dl></dd><dt><span class="section"><a href="#_looking_up_services">3.4. Looking up services</a></span></dt><dd><dl><dt><span class="section"><a href="#_using_ribbon">3.4.1. Using Ribbon</a></span></dt><dt><span class="section"><a href="#_using_the_discoveryclient">3.4.2. Using the DiscoveryClient</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#spring-cloud-consul-config">4. Distributed Configuration with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_how_to_activate_2">4.1. How to activate</a></span></dt><dt><span class="section"><a href="#_customizing">4.2. Customizing</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-config-watch">4.3. Config Watch</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-config-format">4.4. YAML or Properties with Config</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-config-git2consul">4.5. git2consul with Config</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-failfast">4.6. Fail Fast</a></span></dt></dl></dd><dt><span class="chapter"><a href="#spring-cloud-consul-retry">5. Consul Retry</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-bus">6. Spring Cloud Bus with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_how_to_activate_3">6.1. How to activate</a></span></dt></dl></dd><dt><span class="chapter"><a href="#spring-cloud-consul-hystrix">7. Circuit Breaker with Hystrix</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-turbine">8. Hystrix metrics aggregation with Turbine and Consul</a></span></dt></dl></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a name="d0e9" href="#d0e9"></a></h1></div></div></div><p><span class="strong"><strong>2.0.0.BUILD-SNAPSHOT</strong></span></p><p>This project provides Consul integrations for Spring Boot apps through autoconfiguration
|
||||
<title>Spring Cloud Consul</title><link rel="stylesheet" type="text/css" href="css/manual-singlepage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div lang="en" class="book"><div class="titlepage"><div><div><h1 class="title"><a name="d0e3"></a>Spring Cloud Consul</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="preface"><a href="#d0e9"></a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-install">1. Install Consul</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-agent">2. Consul Agent</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-discovery">3. Service Discovery with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_how_to_activate">3.1. How to activate</a></span></dt><dt><span class="section"><a href="#_registering_with_consul">3.2. Registering with Consul</a></span></dt><dt><span class="section"><a href="#_http_health_check">3.3. HTTP Health Check</a></span></dt><dd><dl><dt><span class="section"><a href="#_metadata_and_consul_tags">3.3.1. Metadata and Consul tags</a></span></dt><dt><span class="section"><a href="#_making_the_consul_instance_id_unique">3.3.2. Making the Consul Instance ID Unique</a></span></dt></dl></dd><dt><span class="section"><a href="#_looking_up_services">3.4. Looking up services</a></span></dt><dd><dl><dt><span class="section"><a href="#_using_ribbon">3.4.1. Using Ribbon</a></span></dt><dt><span class="section"><a href="#_using_the_discoveryclient">3.4.2. Using the DiscoveryClient</a></span></dt></dl></dd><dt><span class="section"><a href="#_consul_catalog_watch">3.5. Consul Catalog Watch</a></span></dt></dl></dd><dt><span class="chapter"><a href="#spring-cloud-consul-config">4. Distributed Configuration with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_how_to_activate_2">4.1. How to activate</a></span></dt><dt><span class="section"><a href="#_customizing">4.2. Customizing</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-config-watch">4.3. Config Watch</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-config-format">4.4. YAML or Properties with Config</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-config-git2consul">4.5. git2consul with Config</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-failfast">4.6. Fail Fast</a></span></dt></dl></dd><dt><span class="chapter"><a href="#spring-cloud-consul-retry">5. Consul Retry</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-bus">6. Spring Cloud Bus with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_how_to_activate_3">6.1. How to activate</a></span></dt></dl></dd><dt><span class="chapter"><a href="#spring-cloud-consul-hystrix">7. Circuit Breaker with Hystrix</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-turbine">8. Hystrix metrics aggregation with Turbine and Consul</a></span></dt></dl></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a name="d0e9" href="#d0e9"></a></h1></div></div></div><p><span class="strong"><strong>2.0.0.BUILD-SNAPSHOT</strong></span></p><p>This project provides Consul integrations for Spring Boot apps through autoconfiguration
|
||||
and binding to the Spring Environment and other Spring programming model idioms. With a few
|
||||
simple annotations you can quickly enable and configure the common patterns inside your
|
||||
application and build large distributed systems with Consul based components. The
|
||||
@@ -65,7 +65,7 @@ public String serviceUrl() {
|
||||
return list.get(0).getUri();
|
||||
}
|
||||
return null;
|
||||
}</pre></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="spring-cloud-consul-config" href="#spring-cloud-consul-config"></a>4. Distributed Configuration with Consul</h1></div></div></div><p>Consul provides a <a class="link" href="https://consul.io/docs/agent/http/kv.html" target="_top">Key/Value Store</a> for storing configuration and other metadata. Spring Cloud Consul Config is an alternative to the <a class="link" href="https://github.com/spring-cloud/spring-cloud-config" target="_top">Config Server and Client</a>. Configuration is loaded into the Spring Environment during the special "bootstrap" phase. Configuration is stored in the <code class="literal">/config</code> folder by default. Multiple <code class="literal">PropertySource</code> instances are created based on the application’s name and the active profiles that mimicks the Spring Cloud Config order of resolving properties. For example, an application with the name "testApp" and with the "dev" profile will have the following property sources created:</p><pre class="screen">config/testApp,dev/
|
||||
}</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_consul_catalog_watch" href="#_consul_catalog_watch"></a>3.5 Consul Catalog Watch</h2></div></div></div><p>The Consul Catalog Watch takes advantage of the ability of consul to <a class="link" href="https://www.consul.io/docs/agent/watches.html#services" target="_top">watch services</a>. The Catalog Watch makes a blocking Consul HTTP API call to determine if any services have changed. If there is new service data a Heartbeat Event is published.</p><p>To change the frequency of when the Config Watch is called change <code class="literal">spring.cloud.consul.config.discovery.catalog-services-watch-delay</code>. The default value is 1000, which is in milliseconds. The delay is the amount of time after the end of the previous invocation and the start of the next.</p><p>To disable the Catalog Watch set <code class="literal">spring.cloud.consul.discovery.catalog-services-watch.enabled=false</code>.</p><p>The watch uses a Spring <code class="literal">TaskScheduler</code> to schedule the call to consul. By default it is a <code class="literal">ThreadPoolTaskScheduler</code> with a <code class="literal">poolSize</code> of 1. To change the <code class="literal">TaskScheduler</code>, create a bean of type <code class="literal">TaskScheduler</code> named with the <code class="literal">ConsulDiscoveryClientConfiguration.CATALOG_WATCH_TASK_SCHEDULER_NAME</code> constant.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="spring-cloud-consul-config" href="#spring-cloud-consul-config"></a>4. Distributed Configuration with Consul</h1></div></div></div><p>Consul provides a <a class="link" href="https://consul.io/docs/agent/http/kv.html" target="_top">Key/Value Store</a> for storing configuration and other metadata. Spring Cloud Consul Config is an alternative to the <a class="link" href="https://github.com/spring-cloud/spring-cloud-config" target="_top">Config Server and Client</a>. Configuration is loaded into the Spring Environment during the special "bootstrap" phase. Configuration is stored in the <code class="literal">/config</code> folder by default. Multiple <code class="literal">PropertySource</code> instances are created based on the application’s name and the active profiles that mimicks the Spring Cloud Config order of resolving properties. For example, an application with the name "testApp" and with the "dev" profile will have the following property sources created:</p><pre class="screen">config/testApp,dev/
|
||||
config/testApp/
|
||||
config/application,dev/
|
||||
config/application/</pre><p>The most specific property source is at the top, with the least specific at the bottom. Properties in the <code class="literal">config/application</code> folder are applicable to all applications using consul for configuration. Properties in the <code class="literal">config/testApp</code> folder are only available to the instances of the service named "testApp".</p><p>Configuration is currently read on startup of the application. Sending a HTTP POST to <code class="literal">/refresh</code> will cause the configuration to be reloaded. <a class="xref" href="#spring-cloud-consul-config-watch" title="4.3 Config Watch">Section 4.3, “Config Watch”</a> will also automatically detect changes and reload the application context.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_how_to_activate_2" href="#_how_to_activate_2"></a>4.1 How to activate</h2></div></div></div><p>To get started with Consul Configuration use the starter with group <code class="literal">org.springframework.cloud</code> and artifact id <code class="literal">spring-cloud-starter-consul-config</code>. See the <a class="link" href="http://projects.spring.io/spring-cloud/" target="_top">Spring Cloud Project page</a> for details on setting up your build system with the current Spring Cloud Release Train.</p><p>This will enable auto-configuration that will setup Spring Cloud Consul Config.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_customizing" href="#_customizing"></a>4.2 Customizing</h2></div></div></div><p>Consul Config may be customized using the following properties:</p><p><b>bootstrap.yml. </b>
|
||||
@@ -77,7 +77,7 @@ config/application/</pre><p>The most specific property source is at the top, wit
|
||||
prefix: configuration
|
||||
defaultContext: apps
|
||||
profileSeparator: '::'</pre><p>
|
||||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">enabled</code> setting this value to "false" disables Consul Config</li><li class="listitem"><code class="literal">prefix</code> sets the base folder for configuration values</li><li class="listitem"><code class="literal">defaultContext</code> sets the folder name used by all applications</li><li class="listitem"><code class="literal">profileSeparator</code> sets the value of the separator used to separate the profile name in property sources with profiles</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="spring-cloud-consul-config-watch" href="#spring-cloud-consul-config-watch"></a>4.3 Config Watch</h2></div></div></div><p>The Consul Config Watch takes advantage of the ability of consul to <a class="link" href="https://www.consul.io/docs/agent/watches.html#keyprefix" target="_top">watch a key prefix</a>. The Config Watch makes a blocking Consul HTTP API call to determine if any relevant configuration data has changed for the current application. If there is new configuration data a Refresh Event is published. This is equivalent to calling the <code class="literal">/refresh</code> actuator endpoint.</p><p>To change the frequency of when the Config Watch is called change <code class="literal">spring.cloud.consul.config.watch.delay</code>. The default value is 1000, which is in milliseconds.</p><p>To disable the Config Watch set <code class="literal">spring.cloud.consul.config.watch.enabled=false</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="spring-cloud-consul-config-format" href="#spring-cloud-consul-config-format"></a>4.4 YAML or Properties with Config</h2></div></div></div><p>It may be more convenient to store a blob of properties in YAML or Properties format as opposed to individual key/value pairs. Set the <code class="literal">spring.cloud.consul.config.format</code> property to <code class="literal">YAML</code> or <code class="literal">PROPERTIES</code>. For example to use YAML:</p><p><b>bootstrap.yml. </b>
|
||||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">enabled</code> setting this value to "false" disables Consul Config</li><li class="listitem"><code class="literal">prefix</code> sets the base folder for configuration values</li><li class="listitem"><code class="literal">defaultContext</code> sets the folder name used by all applications</li><li class="listitem"><code class="literal">profileSeparator</code> sets the value of the separator used to separate the profile name in property sources with profiles</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="spring-cloud-consul-config-watch" href="#spring-cloud-consul-config-watch"></a>4.3 Config Watch</h2></div></div></div><p>The Consul Config Watch takes advantage of the ability of consul to <a class="link" href="https://www.consul.io/docs/agent/watches.html#keyprefix" target="_top">watch a key prefix</a>. The Config Watch makes a blocking Consul HTTP API call to determine if any relevant configuration data has changed for the current application. If there is new configuration data a Refresh Event is published. This is equivalent to calling the <code class="literal">/refresh</code> actuator endpoint.</p><p>To change the frequency of when the Config Watch is called change <code class="literal">spring.cloud.consul.config.watch.delay</code>. The default value is 1000, which is in milliseconds. The delay is the amount of time after the end of the previous invocation and the start of the next.</p><p>To disable the Config Watch set <code class="literal">spring.cloud.consul.config.watch.enabled=false</code>.</p><p>The watch uses a Spring <code class="literal">TaskScheduler</code> to schedule the call to consul. By default it is a <code class="literal">ThreadPoolTaskScheduler</code> with a <code class="literal">poolSize</code> of 1. To change the <code class="literal">TaskScheduler</code>, create a bean of type <code class="literal">TaskScheduler</code> named with the <code class="literal">ConsulConfigAutoConfiguration.CONFIG_WATCH_TASK_SCHEDULER_NAME</code> constant.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="spring-cloud-consul-config-format" href="#spring-cloud-consul-config-format"></a>4.4 YAML or Properties with Config</h2></div></div></div><p>It may be more convenient to store a blob of properties in YAML or Properties format as opposed to individual key/value pairs. Set the <code class="literal">spring.cloud.consul.config.format</code> property to <code class="literal">YAML</code> or <code class="literal">PROPERTIES</code>. For example to use YAML:</p><p><b>bootstrap.yml. </b>
|
||||
</p><pre class="screen">spring:
|
||||
cloud:
|
||||
consul:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<book xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en">
|
||||
<info>
|
||||
<title>Spring Cloud Consul</title>
|
||||
<date>2018-05-29</date>
|
||||
<date>2018-06-05</date>
|
||||
</info>
|
||||
<preface>
|
||||
<title></title>
|
||||
@@ -153,6 +153,13 @@ public String serviceUrl() {
|
||||
}</screen>
|
||||
</section>
|
||||
</section>
|
||||
<section xml:id="_consul_catalog_watch">
|
||||
<title>Consul Catalog Watch</title>
|
||||
<simpara>The Consul Catalog Watch takes advantage of the ability of consul to <link xl:href="https://www.consul.io/docs/agent/watches.html#services">watch services</link>. The Catalog Watch makes a blocking Consul HTTP API call to determine if any services have changed. If there is new service data a Heartbeat Event is published.</simpara>
|
||||
<simpara>To change the frequency of when the Config Watch is called change <literal>spring.cloud.consul.config.discovery.catalog-services-watch-delay</literal>. The default value is 1000, which is in milliseconds. The delay is the amount of time after the end of the previous invocation and the start of the next.</simpara>
|
||||
<simpara>To disable the Catalog Watch set <literal>spring.cloud.consul.discovery.catalog-services-watch.enabled=false</literal>.</simpara>
|
||||
<simpara>The watch uses a Spring <literal>TaskScheduler</literal> to schedule the call to consul. By default it is a <literal>ThreadPoolTaskScheduler</literal> with a <literal>poolSize</literal> of 1. To change the <literal>TaskScheduler</literal>, create a bean of type <literal>TaskScheduler</literal> named with the <literal>ConsulDiscoveryClientConfiguration.CATALOG_WATCH_TASK_SCHEDULER_NAME</literal> constant.</simpara>
|
||||
</section>
|
||||
</chapter>
|
||||
<chapter xml:id="spring-cloud-consul-config">
|
||||
<title>Distributed Configuration with Consul</title>
|
||||
@@ -202,8 +209,9 @@ config/application/</screen>
|
||||
<section xml:id="spring-cloud-consul-config-watch">
|
||||
<title>Config Watch</title>
|
||||
<simpara>The Consul Config Watch takes advantage of the ability of consul to <link xl:href="https://www.consul.io/docs/agent/watches.html#keyprefix">watch a key prefix</link>. The Config Watch makes a blocking Consul HTTP API call to determine if any relevant configuration data has changed for the current application. If there is new configuration data a Refresh Event is published. This is equivalent to calling the <literal>/refresh</literal> actuator endpoint.</simpara>
|
||||
<simpara>To change the frequency of when the Config Watch is called change <literal>spring.cloud.consul.config.watch.delay</literal>. The default value is 1000, which is in milliseconds.</simpara>
|
||||
<simpara>To change the frequency of when the Config Watch is called change <literal>spring.cloud.consul.config.watch.delay</literal>. The default value is 1000, which is in milliseconds. The delay is the amount of time after the end of the previous invocation and the start of the next.</simpara>
|
||||
<simpara>To disable the Config Watch set <literal>spring.cloud.consul.config.watch.enabled=false</literal>.</simpara>
|
||||
<simpara>The watch uses a Spring <literal>TaskScheduler</literal> to schedule the call to consul. By default it is a <literal>ThreadPoolTaskScheduler</literal> with a <literal>poolSize</literal> of 1. To change the <literal>TaskScheduler</literal>, create a bean of type <literal>TaskScheduler</literal> named with the <literal>ConsulConfigAutoConfiguration.CONFIG_WATCH_TASK_SCHEDULER_NAME</literal> constant.</simpara>
|
||||
</section>
|
||||
<section xml:id="spring-cloud-consul-config-format">
|
||||
<title>YAML or Properties with Config</title>
|
||||
|
||||
Reference in New Issue
Block a user