From 116c66c14c7a8b3572d8bfcd79d60674d857ec42 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 17 Apr 2015 09:38:29 +0000 Subject: [PATCH] Sync docs from master to gh-pages --- spring-cloud.html | 56 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/spring-cloud.html b/spring-cloud.html index fd57d22..942d785 100644 --- a/spring-cloud.html +++ b/spring-cloud.html @@ -475,7 +475,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
  • Status Page and Health Indicator
  • Eureka Metadata for Instances and Clients
  • Using the DiscoveryClient
  • -
  • Alternatives to the DiscoveryClient
  • +
  • Alternatives to the native Netflix DiscoveryClient
  • Why is it so Slow to Register a Service?
  • @@ -523,6 +523,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b @@ -1924,9 +1925,9 @@ application, so it’s helpful if they are accurate.

    eureka:
       instance:
    +    hostname: ${vcap.application.uris[0]}
    +    nonSecurePort: 80
         metadataMap:
    -      hostname: ${vcap.application.uris[0]}
    -      nonSecurePort: 80
           instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${server.port}}}
    @@ -1996,7 +1997,7 @@ another SmartLifecycle with higher phase.

    -

    Alternatives to the DiscoveryClient

    +

    Alternatives to the native Netflix DiscoveryClient

    You don’t have to use the raw Netflix DiscoveryClient and usually it is more convenient to use it behind a wrapper of some sort. Spring @@ -2008,6 +2009,25 @@ can simply set <client>.ribbon.listOfServers to a comma-separ list of physical addresses (or hostnames), where <client> is the ID of the client.

    +
    +

    You can also use the org.springframework.cloud.client.discovery.DiscoveryClient +which provides a simple API for discovery clients that is not specific +to Netflix, e.g.

    +
    +
    +
    +
    @Autowired
    +private DiscoveryClient discoveryClient;
    +
    +public String serviceUrl() {
    +    List<ServiceInstance> list = client.getInstances("STORES");
    +    if (list != null && list.size() > 0 ) {
    +        return list.get(0).getUri();
    +    }
    +    return null;
    +}
    +
    +

    Why is it so Slow to Register a Service?

    @@ -2834,6 +2854,24 @@ level, but "/myusers/**" matches hierarchically.

    +

    These simple url-routes doesn’t get executed as HystrixCommand nor can you loadbalance multiple url with Ribbon. +To achieve this specify a service-route and configure a Ribbon client for the serviceId, e.g.

    +
    +
    +
    application.yml
    +
    +
     zuul:
    +  routes:
    +    users:
    +      path: /myusers/**
    +      serviceId: users
    +
    + users:
    +  ribbon:
    +    listOfServers: example.com,google.com
    +
    +
    +

    To add a prefix to all mappings, set zuul.prefix to a value, such as /api. The proxy prefix is stripped from the request before the request is forwarded by default (switch this behaviour off with @@ -3084,6 +3122,14 @@ info:

    +

    Addressing all instances of a service

    +
    +
    +

    The "destination" parameter is used in a Spring PathMatcher (with the path separator as a colon :) to determine if an instance will process the message. Using the example from above, "/bus/refresh?destination=customers:**" will target all instances of the "customers" service regardless of the profiles and ports set as the ApplicationContext ID.

    +
    +
    +
    +

    Customizing the AMQP ConnectionFactory

    @@ -3786,7 +3832,7 @@ ProxyAuthenticationProperties] for full details.