Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor load balance client so that users can add their custom implementation #777

Open
liubao68 opened this issue Oct 19, 2022 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@liubao68
Copy link

liubao68 commented Oct 19, 2022

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 #776

Describe the solution you'd like
see #776

Describe alternatives you've considered
see #776

Additional context
NA

This issue is created for future enhancement to loadbalancer client customization.

@OlgaMaciaszek
Copy link
Collaborator

Hello, @liubao68 - we actually provide tracing solutions. Have you checked that out? In any case, I think it'd be ok to allow for custom FeignLoadBalancerClient solutions. This is not going to be a team priority, but feel free to submit a PR similar to the one you've created before, but against the main branch instead. Please make sure to add tests.

@OlgaMaciaszek OlgaMaciaszek removed their assignment Mar 8, 2023
@OlgaMaciaszek OlgaMaciaszek added enhancement New feature or request help wanted Extra attention is needed and removed in progress labels Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants