rename rpcx to zrpc

This commit is contained in:
kevin
2020-09-18 11:41:52 +08:00
parent 26e16107ce
commit 0b1ee79d3a
110 changed files with 154 additions and 154 deletions

View File

@@ -0,0 +1,29 @@
package internal
import "github.com/tal-tech/go-zero/core/discov"
func NewRpcPubServer(etcdEndpoints []string, etcdKey, listenOn string, opts ...ServerOption) (Server, error) {
registerEtcd := func() error {
pubClient := discov.NewPublisher(etcdEndpoints, etcdKey, listenOn)
return pubClient.KeepAlive()
}
server := keepAliveServer{
registerEtcd: registerEtcd,
Server: NewRpcServer(listenOn, opts...),
}
return server, nil
}
type keepAliveServer struct {
registerEtcd func() error
Server
}
func (ags keepAliveServer) Start(fn RegisterFn) error {
if err := ags.registerEtcd(); err != nil {
return err
}
return ags.Server.Start(fn)
}