spring-cloud-netflix

Load balancer does not have available server for client

亡梦爱人 提交于 2019-12-03 00:22:45
I'm trying to use Feign client. Below is my feing client: import com.eprogrammerz.examples.domain.Movie; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * Created by Yogen on 12/26/2016. */ @FeignClient(name = "movie-api") public interface MovieApi { @RequestMapping(method = RequestMethod.GET, value = "/movies/{id}") Movie getMovie(@PathVariable("id") Long id); } I'm calling it from simple

How is Spring Cloud Gateway different from Zuul?

走远了吗. 提交于 2019-12-02 17:23:58
I have been using Zuul as the edge service and API Gateway. Recently I have noticed that Spring Cloud Platform release Spring Cloud Gateway . What is the difference between the two gateways? Why is the Zuul not extended to support the functionalities in S-C-Gateway? What was the driving factor for a new library altogether? When should it be used? I am the author of spring cloud gateway. Zuul is built on servlet 2.5 (works with 3.x), using blocking APIs. It doesn't support any long lived connections, like websockets. Gateway is built on Spring Framework 5, Project Reactor and Spring Boot 2

Difference between @RibbonClient and @LoadBalanced

给你一囗甜甜゛ 提交于 2019-12-02 16:47:45
I understand @LoadBalanced indicates the Rest template should be based on Client Side Load Balancing using Ribbon and checks Eureka server for resolving the service name to host/port. What is the use of @RibbonClient . Is it to support native Ribbon Client LB without Eureka and also support Eureka Discover when configured with DiscoveryEnabledNIWSServerList ? TL;DR : @LoadBalanced is a marker annotation & @RibbonClient is used for configuration purposes. @LoadBalanced Used as a marker annotation indicating that the annotated RestTemplate should use a RibbonLoadBalancerClient for interacting

Overriding managed version 3.2.0 for bootstrap when put <dependencyManagement>

爱⌒轻易说出口 提交于 2019-12-02 09:10:24
when I put <dependencyManagement> getting Overriding managed version 3.2.0 for bootstrap in pom.xml. override dependancies: <dependency> <groupId>org.webjars</groupId> <artifactId>bootstrap-datepicker</artifactId> <version>1.0.1</version> </dependency> <dependency> <groupId>org.webjars</groupId> <artifactId>datatables</artifactId> <version>1.10.19</version> </dependency> pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache

Spring Config Server - No such label: master

那年仲夏 提交于 2019-12-02 06:14:17
问题 I have a simple Spring Cloud Config Server which consume configuration from git server. ConfigServer bootstrap.yml : spring: application: name: config-service cloud: config: server: git: uri: ssh://git@mydomain:myport/myrepo.git searchPaths: "configurations/{application}/{profile}" server: port: 8888 When I deploy ConfigServer on local, I can retrieve configuration from http://localhost:8888/myapp/test . But when I deploy ConfigServer on test server, it throws No such label: master when I hit

How to select route based on header in Zuul

孤者浪人 提交于 2019-12-02 06:05:52
问题 I'm using a Netflix Zuul proxy in front of my services A and B. How can I make the Zuul proxy to choose between routes to A and B based on a HTTP header in the incoming request? 回答1: You should create a prefilter based on your logic. Something like this : @Component public class RedirectionFilter extends ZuulFilter { @Override public String filterType() { return "pre"; } @Override public int filterOrder() { return 2; } @Override public boolean shouldFilter() { return true; } @Override public

How to override the ribbon.serverListRefreshInterval default value in Spring Cloud Ribbon?

落爺英雄遲暮 提交于 2019-12-01 04:06:43
问题 I wrote a simple Spring Cloud Ribbon application, to call a REST service which was registered in Eureka. But how to override the ribbon.serverListRefreshInterval value? The default value is 30 seconds, I'd like to reduce the time interval. Thanks in advance. 回答1: Try with: myService.ribbon.ServerListRefreshInterval=10000 where myService is the name of your destination microservice. UPDATE : After some source code digging I found out that LoadBalancerBuilder calls: @Deprecated public

Changing default port of eureka server using spring cloud

烈酒焚心 提交于 2019-12-01 02:31:23
问题 I got to spring-boot application, an eureka server and an eureka client. Here is my server configuration server: port: 8761 spring: application: name: eureka-server Here is my server code package fr.maif.eurekaserver; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; import org.springframework.cloud.netflix.zuul.EnableZuulProxy;

Zuul/Ribbon/Hystrix not retrying on different instance

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 13:05:37
Background I'm using Spring cloud Brixton.RC2, with Zuul and Eureka. I have one gateway service with @EnableZuulProxy and a book-service with a status method. Via configuration I can emulate work on the status method by sleeping a defined amount of time. The Zuul route is simple zuul.routes.foos.path=/foos/** zuul.routes.foos.serviceId=reservation-service I run two instances of the book-service . When I set the sleeping time below the Hystrix timeout threshold (1000ms) I can see requests going to both instance of the book services. This works well. Problem I understand that if the Hystrix

How to check two condition while using @ConditionalOnProperty or @ConditionalOnExpression

Deadly 提交于 2019-11-30 06:47:15
I need to check that two conditions are satisfied on a YAML property file, while creating a bean. How do I do that, as the @ConditionalOnProperty annotation supports only one property? Use @ConditionalOnExpression annotation and SpEL expression as described here http://docs.spring.io/spring/docs/current/spring-framework-reference/html/expressions.html . Example: @Controller @ConditionalOnExpression("${controller.enabled} and ${some.value} > 10") public class WebController { Josh Since from the beginning of @ConditionalOnProperty it was possible to check more than one property. The name / value