diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/config/GrpcClientConfiguration.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/config/GrpcClientConfiguration.java index 8801f5036e283..0d1f94c7f5eea 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/config/GrpcClientConfiguration.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/config/GrpcClientConfiguration.java @@ -137,4 +137,10 @@ public class GrpcClientConfiguration { @ConfigItem public Optional userAgent; + /** + * Use a custom load balancing policy. + * Accepted values are: {@code pick_value}, {@code round_robin}, {@code grpclb} + */ + @ConfigItem(defaultValue = "pick_first") + public String loadBalancingPolicy; } diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java index a9c86fd383ee9..9fe04ee248977 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java @@ -86,6 +86,7 @@ public static Channel createChannel(String name) throws SSLException { } NettyChannelBuilder builder = NettyChannelBuilder.forAddress(host, port) + .defaultLoadBalancingPolicy(config.loadBalancingPolicy) .flowControlWindow(config.flowControlWindow.orElse(DEFAULT_FLOW_CONTROL_WINDOW)) .keepAliveWithoutCalls(config.keepAliveWithoutCalls) .maxHedgedAttempts(config.maxHedgedAttempts)