netflix-feign

Spring Cloud Feign Client duplicate list values

橙三吉。 提交于 2019-12-12 14:05:59
问题 I have this interface mapping my rest client using Spring cloud Feign. @FeignClient(url = "http://localhost:8080") public interface RestClient { @RequestMapping(value = "?ids={ids}", method = GET) List<Posicao> get(@RequestParam(value = "ids") List ids); } I have a list in my parameters, calling the client I have this request: restClient.get(Arrays.asList(1, 2)); http://localhost:8080/ids=1,2,1,2 It's duplicating the list values! I already tried using an array, an integer and string generic

Feign Client - Dynamic Authorization Header

你。 提交于 2019-12-11 12:49:19
问题 I have a service that gets http request with an authorization header. When processing the request, I want to use a Feign Client to query another service. The query to the other service should include the same authorization header. Currently I use a Filter to extract the authorization header from the incoming request, store the header in a ThreadLocal. When building the Feign Client I use a RequestInterceptor to read the authorization header from the ThreadLocal and put it into the request to

Seeking advice on proper approach to development on Netflix Eureka discoverable Spring Boot services with minimal overheads

早过忘川 提交于 2019-12-11 03:08:42
问题 We are running a Spring Boot-based environment with about 15 microservices and a Zuul edge gateway registered with Eureka. Currently, I have set up all microservices to call other microservices through the Zuul gateway (e.g. if serviceA needs to call serviceB, the URL configuration property would be serviceB.baseUrl=http://zuul.mydomain.com:7001 where zuul.mydomain.com is our development server on AWS with all other microservices running behind it). Zuul in turn proxies to the microservices

Does Spring Cloud Feign client call execute inside hystrix command?

半城伤御伤魂 提交于 2019-12-10 14:17:53
问题 I'm configuring a sample application using this example: http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance. In this section http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-ribbon it is said that: Feign already uses Ribbon, so if you are using @FeignClient then this section also applies Does that mean that @FeignClient uses Hystrix too? Does the call to feign client execute inside hystrix command? if so, what is the proper way to pass

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.

Unreachable security context using Feign RequestInterceptor

空扰寡人 提交于 2019-12-09 12:50:13
问题 The goal is to attach some data from security context using RequestInterceptor, but the problem, that the calling SecurityContextHolder.getContext().getAuthentication() always returns null even though it is not null (I am sure 100%). As I understand that's because the Interceptor is created and is being run in other thread. How could I solve this problem and get actual data from security context? My service: @FeignClient(value = "api", configuration = { FeignConfig.class }) public interface

Using spring cloud feign causes java.lang.NoClassDefFoundError: feign/Logger

浪尽此生 提交于 2019-12-08 17:03:40
问题 I enabled my spring cloud for feignClients like this: @Configuration @EnableAutoConfiguration @RestController @EnableEurekaClient @EnableCircuitBreaker @EnableFeignClients public class SpringCloudConfigClientApplication { } But as oon as I add enableFeignClients, I got this error during compilation, java.lang.NoClassDefFoundError: feign/Logger at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2688) at java.lang.Class

How can I adjust load balancing rule by feign in spring cloud

天大地大妈咪最大 提交于 2019-12-06 05:42:00
问题 As I know, feign include ribbon's function, and I prove it in my code. When I use feign, the default rule is Round Robin Rule. But how can I change the rule in my feign client code, is ribbon the only way? Here is my code below, so please help. ConsumerApplication.java @SpringBootApplication @EnableDiscoveryClient @EnableFeignClients @EnableCircuitBreaker public class ConsumerApplication { public static void main(String[] args) { SpringApplication.run(ConsumerApplication.class, args); } }

Feign builder timeouts not working

流过昼夜 提交于 2019-12-06 04:34:54
We are using Netflix feign to connect to a downstream client, but our request.options connect and read timeouts are not working. This is how we are passing parameters to the builder Feign.builder() .client(new OkHttpClient(okHttpClient)) .encoder(new GsonEncoder()) .decoder(new GsonDecoder()) .options(new Request.Options(connectTimeoutInMS, readTimeoutInMs) .target(*,*); We have set readTimeout and ConnectionTimeout to 1 sec. But what we see is even when the target takes more than 1 sec to respond, it does not timeout and keeps trying to connect. Your request options configurations are not

How to solve Timeout FeignClient

空扰寡人 提交于 2019-12-05 14:57:39
问题 My application is getting below error when consuming a service that performs queries in SQL Server using FeignClient . ERROR: Exception in thread "pool-10-thread-14" feign.RetryableException: Read timed out executing GET http://127.0.0.1:8876/processoData/search/buscaProcessoPorCliente?cliente=ELEKTRO+-+TRABALHISTA&estado=SP My Consumer Service: @FeignClient(url="http://127.0.0.1:8876") public interface ProcessoConsumer { @RequestMapping(method = RequestMethod.GET, value = "/processoData