0

I have following service:

@FeignClient(name = "person", fallback = FeignHystrixFallback.class)
public interface PersonService {

    @RequestMapping(value = "/find", method = RequestMethod.GET)
    Person findPerson(@RequestParam("name") String name);
}

How to change the default timeout and thread pool size?

Neo
  • 2,196
  • 5
  • 32
  • 58
  • hi, hystrix is not defined in feignclient. FeignClient is just an interface for calling a real enpoint. Define hystrix in a controller, component,.... – duardito Aug 06 '16 at 06:57
  • @duardito If so, why does `@FeignClient`'s `fallback=` property work? – Neo Aug 06 '16 at 07:00
  • fallback is a property from histrix, not hystrix itself. Fallback is a property, read this from documentation: http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html. **Hystrix supports the notion of a fallback: a default code path that is executed when they circuit is open or there is an error.** – duardito Aug 06 '16 at 07:13

2 Answers2

1

There are other people that have run into this issue and have posted questions and have answers. The most relevant is this post:

Feign builder timeouts not working

If you are wanting to manage the configuration of Feign you would want to check out the Feign documentation looking at the "configuration" attribute of the @FeignClient annotation.

Community
  • 1
  • 1
Shawn Clark
  • 3,330
  • 2
  • 18
  • 30
0

Set custom configuration for this interface

@FeignClient(name="person", configuration = FeignConfig.class)

and make configuration

public class FeignConfig {
    public static final int FIVE_SECONDS = 5000;

    @Bean
    public Request.Options options() {
        return new Request.Options(FIVE_SECONDS, FIVE_SECONDS);
    }
}
moffeltje
  • 4,521
  • 4
  • 33
  • 57
koa73
  • 861
  • 2
  • 10
  • 27