From 52586d785e481e6105344dee32dfae43b15de8dd Mon Sep 17 00:00:00 2001 From: buildmaster Date: Mon, 17 Sep 2018 20:20:02 +0000 Subject: [PATCH] Sync docs from master to gh-pages --- .../multi_spring-cloud-consul-discovery.html | 18 +++++++++++- multi/multi_spring-cloud-consul.html | 2 +- single/spring-cloud-consul.html | 20 +++++++++++-- spring-cloud-consul.xml | 29 +++++++++++++++++++ 4 files changed, 65 insertions(+), 4 deletions(-) diff --git a/multi/multi_spring-cloud-consul-discovery.html b/multi/multi_spring-cloud-consul-discovery.html index 28f8263c..26900e29 100644 --- a/multi/multi_spring-cloud-consul-discovery.html +++ b/multi/multi_spring-cloud-consul-discovery.html @@ -38,7 +38,23 @@ consul: discovery: instanceId: ${spring.application.name}:${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}

-

With this metadata, and multiple service instances deployed on localhost, the random value will kick in there to make the instance unique. In Cloudfoundry the vcap.application.instance_id will be populated automatically in a Spring Boot application, so the random value will not be needed.

3.4 Looking up services

3.4.1 Using Ribbon

Spring Cloud has support for Feign (a REST client builder) and also Spring RestTemplate +

With this metadata, and multiple service instances deployed on localhost, the random value will kick in there to make the instance unique. In Cloudfoundry the vcap.application.instance_id will be populated automatically in a Spring Boot application, so the random value will not be needed.

3.3.3 Applying Headers to Health Check Requests

Headers can be applied to health check requests. For example, if you’re trying to register a Spring Cloud Config server that uses Vault Backend:

application.yml.  +

spring:
+  cloud:
+    consul:
+      discovery:
+        health-check-headers:
+          X-Config-Token: 6442e58b-d1ea-182e-cfa5-cf9cddef0722

+

According to the HTTP standard, each header can have more than one values, in which case, an array can be supplied:

application.yml.  +

spring:
+  cloud:
+    consul:
+      discovery:
+        health-check-headers:
+          X-Config-Token:
+            - "6442e58b-d1ea-182e-cfa5-cf9cddef0722"
+            - "Some other value"

+

3.4 Looking up services

3.4.1 Using Ribbon

Spring Cloud has support for Feign (a REST client builder) and also Spring RestTemplate for looking up services using the logical service names/ids instead of physical URLs. Both Feign and the discovery-aware RestTemplate utilize Ribbon for client-side load balancing.

If you want to access service STORES using the RestTemplate simply declare:

@LoadBalanced
 @Bean
 public RestTemplate loadbalancedRestTemplate() {
diff --git a/multi/multi_spring-cloud-consul.html b/multi/multi_spring-cloud-consul.html
index 8f1f199b..87632578 100644
--- a/multi/multi_spring-cloud-consul.html
+++ b/multi/multi_spring-cloud-consul.html
@@ -1,3 +1,3 @@
 
       
-   Spring Cloud Consul
\ No newline at end of file
+   Spring Cloud Consul
\ No newline at end of file
diff --git a/single/spring-cloud-consul.html b/single/spring-cloud-consul.html
index 2e84622f..2accd6a4 100644
--- a/single/spring-cloud-consul.html
+++ b/single/spring-cloud-consul.html
@@ -1,6 +1,6 @@
 
       
-   Spring Cloud Consul

Spring Cloud Consul


2.1.0.BUILD-SNAPSHOT

This project provides Consul integrations for Spring Boot apps through autoconfiguration + Spring Cloud Consul

Spring Cloud Consul


2.1.0.BUILD-SNAPSHOT

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 @@ -44,7 +44,23 @@ Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon), Circuit Brea consul: discovery: instanceId: ${spring.application.name}:${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}

-

With this metadata, and multiple service instances deployed on localhost, the random value will kick in there to make the instance unique. In Cloudfoundry the vcap.application.instance_id will be populated automatically in a Spring Boot application, so the random value will not be needed.

3.4 Looking up services

3.4.1 Using Ribbon

Spring Cloud has support for Feign (a REST client builder) and also Spring RestTemplate +

With this metadata, and multiple service instances deployed on localhost, the random value will kick in there to make the instance unique. In Cloudfoundry the vcap.application.instance_id will be populated automatically in a Spring Boot application, so the random value will not be needed.

3.3.3 Applying Headers to Health Check Requests

Headers can be applied to health check requests. For example, if you’re trying to register a Spring Cloud Config server that uses Vault Backend:

application.yml.  +

spring:
+  cloud:
+    consul:
+      discovery:
+        health-check-headers:
+          X-Config-Token: 6442e58b-d1ea-182e-cfa5-cf9cddef0722

+

According to the HTTP standard, each header can have more than one values, in which case, an array can be supplied:

application.yml.  +

spring:
+  cloud:
+    consul:
+      discovery:
+        health-check-headers:
+          X-Config-Token:
+            - "6442e58b-d1ea-182e-cfa5-cf9cddef0722"
+            - "Some other value"

+

3.4 Looking up services

3.4.1 Using Ribbon

Spring Cloud has support for Feign (a REST client builder) and also Spring RestTemplate for looking up services using the logical service names/ids instead of physical URLs. Both Feign and the discovery-aware RestTemplate utilize Ribbon for client-side load balancing.

If you want to access service STORES using the RestTemplate simply declare:

@LoadBalanced
 @Bean
 public RestTemplate loadbalancedRestTemplate() {
diff --git a/spring-cloud-consul.xml b/spring-cloud-consul.xml
index 6445ab06..dd141ba6 100644
--- a/spring-cloud-consul.xml
+++ b/spring-cloud-consul.xml
@@ -115,6 +115,35 @@ public class Application {
 
 With this metadata, and multiple service instances deployed on localhost, the random value will kick in there to make the instance unique. In Cloudfoundry the vcap.application.instance_id will be populated automatically in a Spring Boot application, so the random value will not be needed.
 
+
+Applying Headers to Health Check Requests +Headers can be applied to health check requests. For example, if you’re trying to register a Spring Cloud Config server that uses Vault Backend: + +application.yml + +spring: + cloud: + consul: + discovery: + health-check-headers: + X-Config-Token: 6442e58b-d1ea-182e-cfa5-cf9cddef0722 + + +According to the HTTP standard, each header can have more than one values, in which case, an array can be supplied: + +application.yml + +spring: + cloud: + consul: + discovery: + health-check-headers: + X-Config-Token: + - "6442e58b-d1ea-182e-cfa5-cf9cddef0722" + - "Some other value" + + +
Looking up services