spring-cloud / spring-cloud/spring-cloud-openfeign
refactor load balance client so that users can add their custom implementation
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 838
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 13
Description
Is your feature request related to a problem? Please describe.
My application needs to add a custom Client like FeignBlockingLoadBalancerClient, e.g.
public class CustomFeignBlockingLoadBalancerClient implements Client {
...
}
CustomFeignBlockingLoadBalancerClient will add some extensions to FeignBlockingLoadBalancerClient, like tracing.
This works pretty well when using load-balanced clients. But when mixed with load-balanced and non-load-balanced clients, FeignClientFactoryBean hard coded to work with FeignBlockingLoadBalancerClient to get the delegate
if (client != null) {
if (client instanceof FeignBlockingLoadBalancerClient) {
// not load balancing because we have a url,
// but Spring Cloud LoadBalancer is on the classpath, so unwrap
client = ((FeignBlockingLoadBalancerClient) client).getDelegate();
}
if (client instanceof RetryableFeignBlockingLoadBalancerClient) {
// not load balancing because we have a url,
// but Spring Cloud LoadBalancer is on the classpath, so unwrap
client = ((RetryableFeignBlockingLoadBalancerClient) client).getDelegate();
}
builder.client(client);
}
see https://github.com/spring-cloud/spring-cloud-openfeign/pull/776
Describe the solution you'd like
see https://github.com/spring-cloud/spring-cloud-openfeign/pull/776
Describe alternatives you've considered
see https://github.com/spring-cloud/spring-cloud-openfeign/pull/776
Additional context
NA
This issue is created for future enhancement to loadbalancer client customization.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in FeignClientFactoryBean and inspect FeignBlockingLoadBalancerClient and RetryableFeignBlockingLoadBalancerClient, especially their delegate handling. Review the approach described in spring-cloud-openfeign pull request 776. Done means custom Client implementations can add extensions while mixed load-balanced and URL-based clients still select the correct delegate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100