Added zrpc server custom serverID for custom registration Key when the service is registered on ETCD. (#3008)
This commit is contained in:
@@ -2,6 +2,7 @@ package clientinterceptors
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/zeromicro/go-zero/core/lang"
|
||||
"io"
|
||||
|
||||
ztrace "github.com/zeromicro/go-zero/core/trace"
|
||||
@@ -94,7 +95,7 @@ type (
|
||||
Finished chan error
|
||||
desc *grpc.StreamDesc
|
||||
events chan streamEvent
|
||||
eventsDone chan struct{}
|
||||
eventsDone chan lang.PlaceholderType
|
||||
receivedMessageID int
|
||||
sentMessageID int
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ func NewRpcPubServer(etcd discov.EtcdConf, listenOn string, middlewares ServerMi
|
||||
pubOpts = append(pubOpts, discov.WithPubEtcdTLS(etcd.CertFile, etcd.CertKeyFile,
|
||||
etcd.CACertFile, etcd.InsecureSkipVerify))
|
||||
}
|
||||
if etcd.HasServerID() {
|
||||
pubOpts = append(pubOpts, discov.WithId(etcd.ServerID))
|
||||
}
|
||||
pubClient := discov.NewPublisher(etcd.Hosts, etcd.Key, pubListenOn, pubOpts...)
|
||||
return pubClient.KeepAlive()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user