SpringCloud学习04--服务消费Ribbon和Feign
Ribbon
Ribbon 是一个基于HTTP和TCP客户端的负载均衡器,Feign中也使用了Ribbon,后面会介绍Feign的使用。
它可以在客户端配置ribbonServerList(服务端列表),然后轮询请求以实现均衡负载。
它在联合Eureka使用时ribbonServerList会被DiscoveryEnabledNIWSServerList重写,扩展成从Eureka注册中心获取服务端列表同时它也会用NIWSDiscoveryPing来取代IPing,它将职责委托给Eureka来确定服务端是否已经启动。
Feign
Spring Cloud Netflix的微服务都是以HTTP接口的形式暴露的,所以可以用Apache的HttpClient或Spring的RestTemplate去调用。
而Feign是一个声明式的Web Service客户端,它使得编写Web Serivce客户端变得更加简单。我们只需要使用Feign来创建一个接口并用注解来配置它既可完成。它具备可插拔的注解支持,包括Feign注解和JAX-RS注解。Feign也支持可插拔的编码器和解码器。Spring Cloud为Feign增加了对Spring MVC注解的支持,还整合了Ribbon和Eureka来提供均衡负载的HTTP客户端实现。
是一个使用起来更加方便的Http客户端,它用起来就像调用本地方法一样,完全感觉不到是调用的远程方法。
总结起来就是:发布到注册中心的服务方接口,是Http的,也可以不用Ribbon或Feign,直接在浏览器一样能够访问。
只不过Ribbon或Feign调用起来要方便一些,最重要的是它俩都支持软负载均衡。
注意:spring-cloud-starter-feign里面已经包含了spring-cloud-starter-ribbon
(Feign中也使用了Ribbon)
示例代码
示例代码如下(也可以直接从
Github下载:
https://github.com/v5java/demo-cloud-05-ribbon-feign)
它是由五個模块组成的Maven工程,其中包含一个注册中心、兩个服务提供者、兩个服务消费者(分别由Ribbon和Feign实现)
首先启动服务注册中心
部分日志如下:
. ____ _ __ _ _
/\ / _' __ _ () __ __ _ \ \ \ \
( ( )___ | '_ | '| | ' / _` | \ \ \ \
\/ _)| |)| | | | | || (| | ) ) ) )
' |____| .|| ||| |__, | / / / /
=========||==============|/=///_/
:: Spring Boot :: (v1.5.3.RELEASE)
[20170526094201944][main][SpringApplication.logStartupProfileInfo]No active profile set, falling back to default profiles: default
[20170526094204189][main][ConfigurationClassPostProcessor.enhanceConfigurationClasses]Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
[20170526094207978][localhost-startStop-1][WebApplicationImpl._initiate]Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM'
[20170526094208101][localhost-startStop-1][DiscoveryJerseyProvider.<init>]Using JSON encoding codec LegacyJacksonJson
[20170526094208102][localhost-startStop-1][DiscoveryJerseyProvider.<init>]Using JSON decoding codec LegacyJacksonJson
[20170526094208319][localhost-startStop-1][DiscoveryJerseyProvider.<init>]Using XML encoding codec XStreamXml
[20170526094208319][localhost-startStop-1][DiscoveryJerseyProvider.<init>]Using XML decoding codec XStreamXml
[20170526094212974][main][ArchaiusAutoConfiguration.configureArchaius]No spring.application.name found, defaulting to 'application'
[20170526094212983][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.
[20170526094212983][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
[20170526094213003][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.
[20170526094213003][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
[20170526094213252][main][DiscoveryClient.<init>]Client configured to neither register nor query for data.
[20170526094213288][main][DiscoveryClient.<init>]Discovery Client initialized at timestamp 1495762933287 with initial instances count: 0
[20170526094213487][main][DefaultEurekaServerContext.initialize]Initializing ...
[20170526094213491][main][PeerEurekaNodes.updatePeerEurekaNodes]Adding new peer nodes [http://127.0.0.1:1100/eureka/]
[20170526094214466][main][DiscoveryJerseyProvider.<init>]Using JSON encoding codec LegacyJacksonJson
[20170526094214467][main][DiscoveryJerseyProvider.<init>]Using JSON decoding codec LegacyJacksonJson
[20170526094214467][main][DiscoveryJerseyProvider.<init>]Using XML encoding codec XStreamXml
[20170526094214468][main][DiscoveryJerseyProvider.<init>]Using XML decoding codec XStreamXml
[20170526094214786][main][PeerEurekaNodes.start]Replica node URL: http://127.0.0.1:1100/eureka/
[20170526094214803][main][AbstractInstanceRegistry.initRemoteRegionRegistry]Finished initializing remote region registries. All known remote regions: []
[20170526094214804][main][DefaultEurekaServerContext.initialize]Initialized
[20170526094215684][Thread-11][PeerAwareInstanceRegistryImpl.openForTraffic]Got 1 instances from neighboring DS node
[20170526094215685][Thread-11][PeerAwareInstanceRegistryImpl.openForTraffic]Renew threshold is: 1
[20170526094215685][Thread-11][PeerAwareInstanceRegistryImpl.openForTraffic]Changing status to UP
[20170526094215879][main][StartupInfoLogger.logStarted]Started ServiceDiscoveryBootStrap in 17.0 seconds (JVM running for 21.803)
[20170526094216690][Eureka-EvictionTimer][AbstractInstanceRegistry$EvictionTask.run]Running the evict task with compensationTime 0ms
[20170526094217690][Eureka-EvictionTimer][AbstractInstanceRegistry$EvictionTask.run]Running the evict task with compensationTime 0ms
访问
locahost:1100
启动服务提供方ServiceServer01
部分日志如下
:
. ____ _ __ _ _
/\ / _' __ _ () __ __ _ \ \ \ \
( ( )___ | '_ | '| | ' / _` | \ \ \ \
\/ _)| |)| | | | | || (| | ) ) ) )
' |____| .|| ||| |__, | / / / /
=========||==============|/=///_/
:: Spring Boot :: (v1.5.3.RELEASE)
[20170526100135254][main][SpringApplication.logStartupProfileInfo]No active profile set, falling back to default profiles: default
[20170526100137018][main][ConfigurationClassPostProcessor.enhanceConfigurationClasses]Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
[20170526100145271][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.
[20170526100145277][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
[20170526100145306][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.
[20170526100145306][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
[20170526100148026][main][DiscoveryJerseyProvider.<init>]Using JSON encoding codec LegacyJacksonJson
[20170526100148035][main][DiscoveryJerseyProvider.<init>]Using JSON decoding codec LegacyJacksonJson
[20170526100148322][main][DiscoveryJerseyProvider.<init>]Using XML encoding codec XStreamXml
[20170526100148322][main][DiscoveryJerseyProvider.<init>]Using XML decoding codec XStreamXml
[20170526100148848][main][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration
[20170526100149174][main][DiscoveryClient.fetchRegistry]Disable delta property : false
[20170526100149174][main][DiscoveryClient.fetchRegistry]Single vip registry refresh property : null
[20170526100149177][main][DiscoveryClient.fetchRegistry]Force full registry fetch : false
[20170526100149177][main][DiscoveryClient.fetchRegistry]Application is null : false
[20170526100149177][main][DiscoveryClient.fetchRegistry]Registered Applications size is zero : true
[20170526100149178][main][DiscoveryClient.fetchRegistry]Application version is -1: true
[20170526100149178][main][DiscoveryClient.getAndStoreFullRegistry]Getting all instance registry info from the eureka server
[20170526100149668][main][DiscoveryClient.getAndStoreFullRegistry]The response status is 200
[20170526100149670][main][DiscoveryClient.initScheduledTasks]Starting heartbeat executor: renew interval is: 5
[20170526100149678][main][InstanceInfoReplicator.<init>]InstanceInfoReplicator onDemand update allowed rate per min is 4
[20170526100149684][main][DiscoveryClient.<init>]Discovery Client initialized at timestamp 1495764109684 with initial instances count: 0
[20170526100149798][main][DiscoveryClient$3.notify]Saw local status change event StatusChangeEvent [timestamp=1495764109798, current=UP, previous=STARTING]
[20170526100149823][DiscoveryClient-InstanceInfoReplicator-0][DiscoveryClient.register]DiscoveryClient_CALCULATORSERVER/CalculatorServer:2100: registering service...
[20170526100150570][main][StartupInfoLogger.logStarted]Started ServiceServer01BootStarp in 19.56 seconds (JVM running for 21.528)
[20170526100150593][DiscoveryClient-InstanceInfoReplicator-0][DiscoveryClient.register]DiscoveryClient_CALCULATORSERVER/CalculatorServer:2100 - registration status: 204
[20170526100219672][DiscoveryClient-CacheRefreshExecutor-0][DiscoveryClient.fetchRegistry]Disable delta property : false
刷新localhost:1100,发现多了一个服务:
访问
http://127.0.0.1:2100/add?a=10&b=5
连续访问三次:
http://127.0.0.1:2100/add?a=10&b=5
日志如下:
[20170526101149185][AsyncResolver-bootstrap-executor-0][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration
[20170526101445340][http-nio-2100-exec-1][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=15
[20170526101454636][http-nio-2100-exec-10][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=15
[20170526101506163][http-nio-2100-exec-9][CalculatorController.add]uri=http://172.25.126.162:2100,serviceId=CalculatorServer,result=15
启动服务提供方ServiceServer02
刷新
localhost:1100,发现注册的服务有两个
访问
127.0.0.1:2200/add?a=10&b=10
连续访问两次
127.0.0.1:2200/add?a=10&b=10
日志如下:
[20170526101632306][http-nio-2200-exec-3][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=20
[20170526101641271][http-nio-2200-exec-2][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=20
启动服务消费端ServiceClient01(Ribbon)
部分日志如下
:
. ____ _ __ _ _
/\ / _' __ _ () __ __ _ \ \ \ \
( ( )___ | '_ | '| | ' / _` | \ \ \ \
\/ _)| |)| | | | | || (| | ) ) ) )
' |____| .|| ||| |__, | / / / /
=========||==============|/=///_/
:: Spring Boot :: (v1.5.3.RELEASE)
[20170526101814445][main][SpringApplication.logStartupProfileInfo]No active profile set, falling back to default profiles: default
[20170526101816285][main][ConfigurationClassPostProcessor.enhanceConfigurationClasses]Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
[20170526101825222][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.
[20170526101825224][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
[20170526101825255][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.
[20170526101825258][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
[20170526101827448][main][DiscoveryJerseyProvider.<init>]Using JSON encoding codec LegacyJacksonJson
[20170526101827454][main][DiscoveryJerseyProvider.<init>]Using JSON decoding codec LegacyJacksonJson
[20170526101827811][main][DiscoveryJerseyProvider.<init>]Using XML encoding codec XStreamXml
[20170526101827811][main][DiscoveryJerseyProvider.<init>]Using XML decoding codec XStreamXml
[20170526101828342][main][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration
[20170526101828662][main][DiscoveryClient.fetchRegistry]Disable delta property : false
[20170526101828662][main][DiscoveryClient.fetchRegistry]Single vip registry refresh property : null
[20170526101828662][main][DiscoveryClient.fetchRegistry]Force full registry fetch : false
[20170526101828663][main][DiscoveryClient.fetchRegistry]Application is null : false
[20170526101828663][main][DiscoveryClient.fetchRegistry]Registered Applications size is zero : true
[20170526101828663][main][DiscoveryClient.fetchRegistry]Application version is -1: true
[20170526101828663][main][DiscoveryClient.getAndStoreFullRegistry]Getting all instance registry info from the eureka server
[20170526101829165][main][DiscoveryClient.getAndStoreFullRegistry]The response status is 200
[20170526101829167][main][DiscoveryClient.initScheduledTasks]Starting heartbeat executor: renew interval is: 5
[20170526101829181][main][InstanceInfoReplicator.<init>]InstanceInfoReplicator onDemand update allowed rate per min is 4
[20170526101829185][main][DiscoveryClient.<init>]Discovery Client initialized at timestamp 1495765109185 with initial instances count: 2
[20170526101829274][main][DiscoveryClient$3.notify]Saw local status change event StatusChangeEvent [timestamp=1495765109274, current=UP, previous=STARTING]
[20170526101829278][DiscoveryClient-InstanceInfoReplicator-0][DiscoveryClient.register]DiscoveryClient_CLIENT-CONSUMER-RIBBON/client-consumer-ribbon:3100: registering service...
[20170526101829386][DiscoveryClient-InstanceInfoReplicator-0][DiscoveryClient.register]DiscoveryClient_CLIENT-CONSUMER-RIBBON/client-consumer-ribbon:3100 - registration status: 204
[20170526101829694][main][StartupInfoLogger.logStarted]Started ServiceClient01BootStarp in 19.749 seconds (JVM running for 21.296)
访问localhost:1100,发现Application里多了一个Client-consume-ribbon
多次访问(六次)
http://127.0.0.1:3100/toadd 可以看到两个服务端打印的请求日志是均等输出的,各输出三次:
[20170526151033675][http-nio-2100-exec-3][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=30
[20170526151057257][http-nio-2100-exec-1][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=30
[20170526151110916][http-nio-2100-exec-9][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=30
[20170526151036583][http-nio-2200-exec-3][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=30
[20170526151059570][http-nio-2200-exec-1][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=30
[20170526151109162][http-nio-2200-exec-9][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=30
启动服务消费端ServiceClient02(Feign)
部分日志如下:
. ____ _ __ _ _
/\ / _' __ _ () __ __ _ \ \ \ \
( ( )___ | '_ | '| | ' / _` | \ \ \ \
\/ _)| |)| | | | | || (| | ) ) ) )
' |____| .|| ||| |__, | / / / /
=========||==============|/=///_/
:: Spring Boot :: (v1.5.3.RELEASE)
[20170526103133421][main][SpringApplication.logStartupProfileInfo]No active profile set, falling back to default profiles: default
[20170526103135610][main][ConfigurationClassPostProcessor.enhanceConfigurationClasses]Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
[20170526103143115][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.
[20170526103143116][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
[20170526103143137][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.
[20170526103143138][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
[20170526103144853][main][DiscoveryJerseyProvider.<init>]Using JSON encoding codec LegacyJacksonJson
[20170526103144858][main][DiscoveryJerseyProvider.<init>]Using JSON decoding codec LegacyJacksonJson
[20170526103145270][main][DiscoveryJerseyProvider.<init>]Using XML encoding codec XStreamXml
[20170526103145270][main][DiscoveryJerseyProvider.<init>]Using XML decoding codec XStreamXml
[20170526103145932][main][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration
[20170526103146163][main][DiscoveryClient.fetchRegistry]Disable delta property : false
[20170526103146163][main][DiscoveryClient.fetchRegistry]Single vip registry refresh property : null
[20170526103146163][main][DiscoveryClient.fetchRegistry]Force full registry fetch : false
[20170526103146164][main][DiscoveryClient.fetchRegistry]Application is null : false
[20170526103146164][main][DiscoveryClient.fetchRegistry]Registered Applications size is zero : true
[20170526103146164][main][DiscoveryClient.fetchRegistry]Application version is -1: true
[20170526103146164][main][DiscoveryClient.getAndStoreFullRegistry]Getting all instance registry info from the eureka server
[20170526103146695][main][DiscoveryClient.getAndStoreFullRegistry]The response status is 200
[20170526103146697][main][DiscoveryClient.initScheduledTasks]Starting heartbeat executor: renew interval is: 5
[20170526103146700][main][InstanceInfoReplicator.<init>]InstanceInfoReplicator onDemand update allowed rate per min is 4
[20170526103146707][main][DiscoveryClient.<init>]Discovery Client initialized at timestamp 1495765906706 with initial instances count: 3
[20170526103146794][main][DiscoveryClient$3.notify]Saw local status change event StatusChangeEvent [timestamp=1495765906794, current=UP, previous=STARTING]
[20170526103146810][DiscoveryClient-InstanceInfoReplicator-0][DiscoveryClient.register]DiscoveryClient_CLIENT-CONSUMER-FEIGN/client-consumer-feign:3200: registering service...
[20170526103146897][DiscoveryClient-InstanceInfoReplicator-0][DiscoveryClient.register]DiscoveryClient_CLIENT-CONSUMER-FEIGN/client-consumer-feign:3200 - registration status: 204
[20170526103147401][main][StartupInfoLogger.logStarted]Started ServiceClient02BootStarp in 18.382 seconds (JVM running for 19.856)
访问localhost:1100,发现Application多了一个Client-Consume-Feign
访问127.0.0.1:3200/demo/feign/toad?a=11&b=22
多次访问(六次)
http://127.0.0.1:3200/demo/feign/toadd?a=20&b=40
可以看到两个服务端打印的请求日志是均等输出的,各输出三次:
[20170526151424081][http-nio-2100-exec-6][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=60
[20170526151430819][http-nio-2100-exec-5][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=60
[20170526151437541][AsyncResolver-bootstrap-executor-0][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration
[20170526151500833][http-nio-2100-exec-3][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=60
[20170526151428657][http-nio-2200-exec-8][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=60
[20170526151444082][http-nio-2200-exec-5][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=60
[20170526151458507][http-nio-2200-exec-3][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=60
遇到问题:
如果将service-client-01的ConsumerController改为:
<pre>
@RequestMapping(value = "/toadd",method = RequestMethod.GET)**
public int toadd(@RequestParam int a, @RequestParam int b){
InstanceInfo instance = eurekaClient.getNextServerFromEureka("CalculatorServer",false);
Integer r = a + b;
logger.info("/add, host:" **+instance.getHostName() + **",serviceId:" **+ instance.getInstanceId() + **",result:" **+ r);
return calculatorService.addService(a, b);}
</pre>
CaculatorService.Class:
<pre>
@Service
**class **CalculatorService {
@Resource
**private *RestTemplate restTemplate;
// @RequestMapping(value="add",method = RequestMethod.GET)****
// int addService(@RequestParam("a") int a,@RequestParam("b") int b){****
// String reqURL = "http://CalculatorServer/add?a=" + a + "&b=" + b;****
// //String reqURL = "http://CalculatorServer:3100/demo/ribbon/toadd?a=" + a + "&b=" +b;****
// return restTemplate.getForEntity(reqURL, Integer.class).getBody();****
//****
// }****
**public int addService(int a,int **b){
String reqURL = **"http://CalculatorServer/add?a=" **+ a + **"&b=" **+ b;
**return restTemplate.getForEntity(reqURL,Integer.class).getBody();
}
}
</pre>
访问:
http://127.0.0.1:3100/toadd?a=100&b=200
报错如下;
**Whitelabel Error Page****
**
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri May 26 16:02:40 CST 2017
There was an unexpected error (type=Bad Request, status=400).
Could not read JSON document: Can not deserialize instance of java.lang.Integer out of START_OBJECT token at [Source: java.io.PushbackInputStream@47bf45de; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.Integer out of START_OBJECT token at [Source: java.io.PushbackInputStream@47bf45de; line: 1, column: 1]
但是四次访问却是负载均衡的:
[20170526161145179][http-nio-2100-exec-5][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=300
[20170526161149228][http-nio-2100-exec-4][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=300
[20170526161437557][AsyncResolver-bootstrap-executor-0][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration
[20170526161450505][http-nio-2100-exec-3][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=300
[20170526161147229][http-nio-2200-exec-8][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=300
[20170526161151024][http-nio-2200-exec-6][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=300
[20170526161314964][AsyncResolver-bootstrap-executor-0][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration
[20170526161448600][http-nio-2200-exec-5][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=300