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:
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?
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:https://github.com/micronaut-projects/micronaut-core/blob/3adad0002a19c6288f508ae00b01c8b2596203fe/http-client-core/src/main/java/io/micronaut/http/client/LoadBalancer.java#L42
there is no way one could specify the discriminator.
DefaultHttpClient's resolveURI invokes
getLoadBalancerDiscriminator()
:https://github.com/micronaut-projects/micronaut-core/blob/3adad0002a19c6288f508ae00b01c8b2596203fe/http-client/src/main/java/io/micronaut/http/client/netty/DefaultHttpClient.java#L1504
but
getLoadBalancerDiscrminator()
is always empty:https://github.com/micronaut-projects/micronaut-core/blob/3adad0002a19c6288f508ae00b01c8b2596203fe/http-client/src/main/java/io/micronaut/http/client/netty/DefaultHttpClient.java#L1235-L1237
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.