spring-cloud-netflix

How to register spring boot microservices on spring cloud Netflix eureka?

眉间皱痕 提交于 2019-12-11 06:18:01
问题 We were planning to use spring cloud Netflix oss components. So I was doing a small sample project. I developed 2 spring microservices and those services runs well on http://localhost:9000/microsvc-one http://localhost:9001/microsvc-two And also wrote a sample spring cloud etflix eureka maven project which runs well on http://localhost:8761 I used annotations @EurekaDiscoveryClient and @SpringBootApplication on both the spring boot microservices main class I used annotation

How to implement Sleuth Tracing With Feign.Builder?

筅森魡賤 提交于 2019-12-11 01:48:20
问题 I'm trying to integrate Sleuth into our system. If I use interfaces annotated with @FeignClient , everything works fine. These interfaces get instrumented automatically, and Sleuth headers get propagated with REST calls. But, we have some existing code that uses Feign.Builder directly with Feign annotated interfaces (just not annotated with @FeignClient ). This code adds some custom request interceptors, encoder, proxy, etc. For example: // Feign REST interface public interface MyService {

How to aggregate hystrix metrics with turbine-stream and kafka when using spring cloud?

社会主义新天地 提交于 2019-12-11 01:18:44
问题 When I aggregate hystrix metrics in clusters with turbine when using spring cloud stream and kafka stream. I encountered the following error: 2017-03-07 16:54:57.519 INFO 12808 --- [o-eventloop-3-1] o.s.c.n.t.s.TurbineStreamConfiguration : SSE Request Received 2017-03-07 16:54:57.519 INFO 12808 --- [o-eventloop-3-2] o.s.c.n.t.s.TurbineStreamConfiguration : SSE Request Received 2017-03-07 16:55:04.121 INFO 12808 --- [o-eventloop-3-3] o.s.c.n.t.s.TurbineStreamConfiguration : Unsubscribing

Ribbon load balance algorithms

烈酒焚心 提交于 2019-12-10 15:53:49
问题 I am using Spring Cloud with NetflixOSS in my microservice project. Also, I am using Ribbon with Feign Client as my client side load balancer. I was wondering, is there any possibility to implement or choose different types of load balancing algorithms for Ribbon? Because as I understood, the default is round robin. Thanks in advance! 回答1: Yes, it is possible. See the docs for full details how to customize. For a @FeignClient("foo") and a random load-balancing rule you could do:

Microservices - Connection Pooling when connecting to a single legacy database

半城伤御伤魂 提交于 2019-12-10 15:52:17
问题 I am working on developing micro services for a monolithic application using spring boot + spring cloud + spring JDBC. Currently, the application is connecting to a single database through tomcat JNDI connection pool. We have a bottleneck here, not to change the database architecture at this point of time because of various reasons like large number of db objects,tight dependencies with other systems,etc. So we have isolated the micro services based on application features. My concern is if

Spring boot-Exception in thread “main” java.lang.NoSuchMethodError: org.springframew..(Version Issue)

自古美人都是妖i 提交于 2019-12-10 11:49:35
问题 I am getting Exception while running server .I know it is version issue of Spring boot and spring-cloud . But I am using spring boot 1.4.2.RELEASE and currently spring cloud using Finchley.SR1 . What is suitable version of spring cloud with spring boot 1.4.2.RELEASE? Getting exception below: Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Class;)V at org.springframework.cloud.bootstrap

How to disable eureka lookup on specific @FeignClient

倾然丶 夕夏残阳落幕 提交于 2019-12-10 09:32:47
问题 I have a microservice that uses @FeignClient predominantly to talk to other micro-services. This works beautifuly using Eureka's service discovery mechanism. Now I have a pressing need to use a @FeignClient to connect to an external system and still perform load balancing using configurations as shown below. Feign client : @FeignClient("externalServers") public interface ExternalServersClient { @RequestMapping(method = RequestMethod.GET, value = "/someExternalUrl") ResponseEntity<Object>

Spring Cloud Sleuth + log4j2

左心房为你撑大大i 提交于 2019-12-10 03:52:21
问题 Some of my microservices use log4j2 as logger. Spring cloud Sleuth has support for logback. How can I use Sleuth to get distributed tracing in this scenario. I understand to use sleuth with log4j2, I have to implement certain class. I tried this but no luck. Please help 回答1: Please try with the latest 2.0.0.M6 release where we use Brave internally. You can check out the https://github.com/openzipkin/brave/tree/master/context/log4j12 module how to set up the logging mechanism properly. In

Setting the route programmatically in Spring Cloud Netflix Zuul

最后都变了- 提交于 2019-12-09 18:38:01
问题 I have created two AWS Beanstalk envs, each with their own version of the applications. The urls for these envs are https://beta.myserver.com/v1073 and https://beta.myserver.com/v1084. These urls point to the load balancer. Now I also have a Zuul implementation that have the following configurations. zuul: routes: beta: path: /api/** serviceId: beta-root strip-prefix: false sensitive-headers: Cookie,Set-Cookie ribbon: eureka: enabled: false hystrix: command: default: execution: isolation:

How to fine-tune the Spring Cloud Feign client?

回眸只為那壹抹淺笑 提交于 2019-12-09 13:19:12
问题 The Spring Cloud doc says: If Hystrix is on the classpath, by default Feign will wrap all methods with a circuit breaker. That's good but how do I configure the Hystrix options to ignore certain exceptions? I've an ErrorDecoder implementation that maps HTTP status code to exceptions. If I put @HystrixCommand on the method, does Feign honor that? Our requirement is to log various details about every HTTP call made out to dependencies. Currently I've a decorated RestTemplate that does this.