Skip to content

Commit

Permalink
Merge pull request #15861 from 0SkillAllLuck/main
Browse files Browse the repository at this point in the history
gRPC LoadBalancingPolicy Support
  • Loading branch information
michalszynkiewicz authored Mar 19, 2021
2 parents f54f17f + 66e8fc9 commit 82e052b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,10 @@ public class GrpcClientConfiguration {
@ConfigItem
public Optional<String> 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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 82e052b

Please sign in to comment.