diff --git a/mainboilerplate/client.go b/mainboilerplate/client.go index 3c053182..94e62ec1 100644 --- a/mainboilerplate/client.go +++ b/mainboilerplate/client.go @@ -2,6 +2,7 @@ package mainboilerplate import ( "context" + "fmt" "time" grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" @@ -9,6 +10,7 @@ import ( pb "go.gazette.dev/core/broker/protocol" pc "go.gazette.dev/core/consumer/protocol" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) // AddressConfig of a remote service. @@ -20,8 +22,8 @@ type AddressConfig struct { func (c *AddressConfig) MustDial(ctx context.Context) *grpc.ClientConn { var cc, err = grpc.DialContext(ctx, c.Address.GRPCAddr(), - grpc.WithInsecure(), - grpc.WithBalancerName(pb.DispatcherGRPCBalancerName), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"loadBalancingConfig": [{"%s":{}}]}`, pb.DispatcherGRPCBalancerName)), // Use a tighter bound for the maximum back-off delay (default is 120s). // TODO(johnny): Make this configurable? grpc.WithBackoffMaxDelay(time.Second*5), diff --git a/server/server.go b/server/server.go index ef3e84cd..5885c8f5 100644 --- a/server/server.go +++ b/server/server.go @@ -15,6 +15,7 @@ import ( pb "go.gazette.dev/core/broker/protocol" "go.gazette.dev/core/task" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) // Server bundles gRPC & HTTP servers, multiplexed over a single bound TCP @@ -91,8 +92,8 @@ func New(iface string, port string) (*Server, error) { srv.GRPCLoopback, err = grpc.DialContext( context.Background(), srv.RawListener.Addr().String(), - grpc.WithInsecure(), - grpc.WithBalancerName(pb.DispatcherGRPCBalancerName), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"loadBalancingConfig": [{"%s":{}}]}`, pb.DispatcherGRPCBalancerName)), // This grpc.ClientConn connects to this server's loopback, and also // to peer server addresses via the dispatch balancer. It has particular // knowledge of what addresses *should* be reach-able (from Etcd