apache / dubbo-go

Go Implementation For Apache Dubbo .
https://dubbo.apache.org/
Apache License 2.0
4.73k stars 929 forks source link

metadata report doesn't work without service-discovery #939

Closed beiwei30 closed 3 years ago

beiwei30 commented 3 years ago

What happened:

Use https://github.com/apache/dubbo-go-samples/tree/master/general/dubbo/go-server as an example:

  1. edit "conf/server.yml":
diff --git a/general/dubbo/go-server/cmd/server.go b/general/dubbo/go-server/cmd/server.go
index 8c12a69..8913fb7 100644
--- a/general/dubbo/go-server/cmd/server.go
+++ b/general/dubbo/go-server/cmd/server.go
@@ -35,6 +35,7 @@ import (
    _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
    "github.com/apache/dubbo-go/config"
    _ "github.com/apache/dubbo-go/filter/filter_impl"
+   _ "github.com/apache/dubbo-go/metadata/report/zookeeper"
    _ "github.com/apache/dubbo-go/protocol/dubbo"
    _ "github.com/apache/dubbo-go/registry/protocol"
    _ "github.com/apache/dubbo-go/registry/zookeeper"
diff --git a/general/dubbo/go-server/conf/server.yml b/general/dubbo/go-server/conf/server.yml
index af90434..faa8853 100644
--- a/general/dubbo/go-server/conf/server.yml
+++ b/general/dubbo/go-server/conf/server.yml
@@ -7,6 +7,17 @@ application:
   module: "dubbo-go user-info server"
   version: "0.0.1"
   environment: "dev"
+  metadataType: "remote"
+
+metadata_report:
+  protocol: "zookeeper"
+  remote_ref: "zookeeper"
+
+remote:
+  "zookeeper":
+    protocol: "zookeeper"
+    address: "127.0.0.1:2181"
+

 # registry config
 registries:
  1. edit "cmd/server.go":
diff --git a/general/dubbo/go-server/cmd/server.go b/general/dubbo/go-server/cmd/server.go
index 8c12a69..8913fb7 100644
--- a/general/dubbo/go-server/cmd/server.go
+++ b/general/dubbo/go-server/cmd/server.go
@@ -35,6 +35,7 @@ import (
    _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
    "github.com/apache/dubbo-go/config"
    _ "github.com/apache/dubbo-go/filter/filter_impl"
+   _ "github.com/apache/dubbo-go/metadata/report/zookeeper"
    _ "github.com/apache/dubbo-go/protocol/dubbo"
    _ "github.com/apache/dubbo-go/registry/protocol"
    _ "github.com/apache/dubbo-go/registry/zookeeper
  1. start general/dubbo/go-server in IDE, make sure ”working directory" points to "general/dubbo/go-server", and config "environment" to "CONF_PROVIDER_FILE_PATH=conf/server.yml" in Intellij Idea's "Run/Debug Configurations"

  2. Observe https://github.com/apache/dubbo-go/blob/master/config/config_loader.go#L318, zookeeper's metadata reporter can be initialized successfully.

  3. However, breakpoint at https://github.com/apache/dubbo-go/blob/master/metadata/report/zookeeper/report.go#L55 will not stop, that means metadata report doesn't work.

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Patrick0308 commented 3 years ago

Fixed by #948