-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
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:
micronaut-core/http-client-core/src/main/java/io/micronaut/http/client/LoadBalancer.java
Line 42 in 3adad00
| Publisher<ServiceInstance> select(@Nullable Object discriminator); |
there is no way one could specify the discriminator.
DefaultHttpClient's resolveURI invokes getLoadBalancerDiscriminator():
micronaut-core/http-client/src/main/java/io/micronaut/http/client/netty/DefaultHttpClient.java
Line 1504 in 3adad00
| return Flux.from(loadBalancer.select(getLoadBalancerDiscriminator())).map(server -> { |
but getLoadBalancerDiscrminator() is always empty:
micronaut-core/http-client/src/main/java/io/micronaut/http/client/netty/DefaultHttpClient.java
Lines 1235 to 1237 in 3adad00
| 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
Labels
Type
Projects
Status