Skip to content

Commit

Permalink
Optimizing service registration
Browse files Browse the repository at this point in the history
  • Loading branch information
dobyte committed Oct 15, 2024
1 parent f0431e2 commit 0d2b778
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cluster/mesh/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (p *Proxy) AddHookListener(hook cluster.Hook, handler HookHandler) {
}

// NewMeshClient 新建微服务客户端
// target参数可分为两种模式:
// target参数可分为三种模式:
// 服务直连模式: direct://127.0.0.1:8011
// 服务直连模式: direct://711baf8d-8a06-11ef-b7df-f4f19e1f0070
// 服务发现模式: discovery://service_name
Expand Down
4 changes: 4 additions & 0 deletions transport/grpc/transporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func (t *Transporter) NewServer() (transport.Server, error) {
}

// NewClient 新建微服务客户端
// target参数可分为三种模式:
// 服务直连模式: direct://127.0.0.1:8011
// 服务直连模式: direct://711baf8d-8a06-11ef-b7df-f4f19e1f0070
// 服务发现模式: discovery://service_name
func (t *Transporter) NewClient(target string) (transport.Client, error) {
t.once.Do(func() {
t.builder = client.NewBuilder(&t.opts.client)
Expand Down
4 changes: 4 additions & 0 deletions transport/rpcx/transporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ func (t *Transporter) NewServer() (transport.Server, error) {
}

// NewClient 新建传输客户端
// target参数可分为三种模式:
// 服务直连模式: direct://127.0.0.1:8011
// 服务直连模式: direct://711baf8d-8a06-11ef-b7df-f4f19e1f0070
// 服务发现模式: discovery://service_name
func (t *Transporter) NewClient(target string) (transport.Client, error) {
t.once.Do(func() {
t.builder = client.NewBuilder(&t.opts.client)
Expand Down
4 changes: 4 additions & 0 deletions transport/transporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ type Transporter interface {
// NewServer 新建传输服务器
NewServer() (Server, error)
// NewClient 新建传输务客户端
// target参数可分为三种模式:
// 服务直连模式: direct://127.0.0.1:8011
// 服务直连模式: direct://711baf8d-8a06-11ef-b7df-f4f19e1f0070
// 服务发现模式: discovery://service_name
NewClient(target string) (Client, error)
// SetDefaultDiscovery 设置默认的服务发现组件
SetDefaultDiscovery(discovery registry.Discovery)
Expand Down

0 comments on commit 0d2b778

Please sign in to comment.