Skip to content

LoadBalancer.java: provide the outgoing http request during select() #8823

@mcac0006

Description

@mcac0006

Feature description

I would like to write my own LoadBalancer which selects the right ServerInstance based on the outgoing HTTP request. Sadly, this is currently impossible. While a LoadBalancer has an Object discrminiator on which the LB can rely on:

Publisher<ServiceInstance> select(@Nullable Object discriminator);

there is no way one could specify the discriminator.

DefaultHttpClient's resolveURI invokes getLoadBalancerDiscriminator():

return Flux.from(loadBalancer.select(getLoadBalancerDiscriminator())).map(server -> {

but getLoadBalancerDiscrminator() is always empty:

protected Object getLoadBalancerDiscriminator() {
return null;
}

And although it has a protected access modifier, it does not give me any context about the outgoing request, making an extension DefaultHttpClient pointless.


It looks like there was an attempt to give context to the LoadBalancer. Could you help me understand why it has been left this way, and whether there are plans which helps us derive our own discriminator value?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions