Skip to content

Commit

Permalink
gRPC LoadBalancingPolicy Support
Browse files Browse the repository at this point in the history
  • Loading branch information
0SkillAllLuck committed Mar 18, 2021
1 parent 3781da9 commit 66e8fc9
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 66e8fc9

Please sign in to comment.