Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi Protocols doesn't work on Nacos #2581

Open
mark4z opened this issue Jan 15, 2024 · 1 comment
Open

Multi Protocols doesn't work on Nacos #2581

mark4z opened this issue Jan 15, 2024 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@mark4z
Copy link
Member

mark4z commented Jan 15, 2024

Environment

  • Server: Dubbo-go v3.1.1-rc1
  • Client:
  • Protocol: tri/dubbo
  • Registry: Nacos

Issue description

nacos-go-sdkv2.0 changed the semantics of namingclient.RegisterInstance, resulting in each RegisterInstance() overwriting the entire nacos service instead of appending an Instance.

I think this is an unreasonably breaking change of nacos-go-sdk, and perhaps nacos-go-sdk rather than dubbogo should be the one to fix it.

  protocols:
    dubbo:
      name: dubbo
      port: 20000
    tri:
      name: tri
      port: 20001
// Register will register the service @url to its nacos registry center.
func (nr *nacosRegistry) Register(url *common.URL) error {
	start := time.Now()
	serviceName := getServiceName(url)
	groupName := nr.URL.GetParam(constant.NacosGroupKey, defaultGroup)
	param := createRegisterParam(url, serviceName, groupName)
	logger.Infof("[Nacos Registry] Registry instance with param = %+v", param)
	isRegistry, err := nr.namingClient.Client().RegisterInstance(param)
	metrics.Publish(metricsRegistry.NewRegisterEvent(err == nil && isRegistry, start))
	if err != nil {
		return err
	}
	if !isRegistry {
		return perrors.New("registry [" + serviceName + "] to  nacos failed")
	}
	nr.registryUrls = append(nr.registryUrls, url)
	return nil
}

image

Logs

Click me to check logs
Copy logs to here.
@chickenlj
Copy link
Contributor

There's another API in Nacos 2.x, something like batchRegister to register all protocol instances at once. I think dubbo-go can try to support this change in Nacos 2.x.

@chickenlj chickenlj added this to the v3.2.0-rc2 milestone Mar 6, 2024
@chickenlj chickenlj added the enhancement New feature or request label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants