In production we need to adjust feign client connectTimeout and readTimeout frequently due to some unavoidable circumstances
Feign comes with out of the box connectTimeout and readTimeout support at default level feign.client.default or contextId level feign.client.{contextId}. Since these properties are applied at the time of FeignClient creation and there is no way to refresh these settings via /actuator/refresh other than re-deploying or restarting the spring boot application again.
@RefreshScope cannot be used on the class with @FeignClient because every feign client is a proxy instances of an interface.
Possible solution
- FeignClient when constructed from org.springframework.cloud .openfeign.FeignClientFactoryBean should be composed with Refresh scoped feign.Request.Options bean for each FeignClient instance.
- Then /actuator/refresh will be able to refresh feign.Request.Options and hence connectTimeout and readTimeout.
Additional context If request looks justified then I can share idea and approach in more detail.
Comment From: OlgaMaciaszek
Hello, @jas34 . Will discuss with the team and get back to you.
Comment From: jas34
@OlgaMaciaszek any feedback yet?
Comment From: jas34
@OlgaMaciaszek did you get a chance to discuss this?
Comment From: jas34
@OlgaMaciaszek anything on this yet?
Comment From: OlgaMaciaszek
@jas34 Sorry for getting back so late - have overlooked this issue. We are not planning to be working on it, however, if you would like to provide a PR, we could add it as an enhancement.
Comment From: jas34
Sure, I will share PR soon.
Comment From: jas34
@OlgaMaciaszek I am done with development, need to raise PR but I am not able to push code as I am getting 403 from git.
As mentioned in Contributing I have gone through Individual Contributor License Agreement but not getting any option to accept the agreement. Can you please help, looks like I am missing something?
Comment From: jas34
The above problem is resolved. @OlgaMaciaszek here is PR https://github.com/spring-cloud/spring-cloud-openfeign/pull/526