Skip to content

Commit

Permalink
fix: fix dynamic naming mapping of app level service disc (apache#155)
Browse files Browse the repository at this point in the history
* fix: fix dynamic mapping

* fix
  • Loading branch information
LaurenceLiZhixin authored Jul 13, 2021
1 parent 7e51e8a commit c875ae7
Show file tree
Hide file tree
Showing 19 changed files with 100 additions and 57 deletions.
17 changes: 17 additions & 0 deletions .run/router-client (1).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="router-client (1)" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="router-zk">
<module name="dubbo-go-samples" />
<working_directory value="$PROJECT_DIR$" />
<envs>
<env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/router/uniform-router/file/go-client/conf/log.yml" />
<env name="CONF_CONSUMER_FILE_PATH" value="$PROJECT_DIR$/router/uniform-router/zookeeper/go-client/conf/client.yml" />
<env name="CONF_VIRTUAL_SERVICE_FILE_PATH" value="$PROJECT_DIR$/router/uniform-router/zookeeper/go-client/conf/virtual_service.yml" />
<env name="CONF_DEST_RULE_FILE_PATH" value="$PROJECT_DIR$/router/uniform-router/zookeeper/go-client/conf/dest_rule.yml" />
</envs>
<kind value="PACKAGE" />
<filePath value="$PROJECT_DIR$/router/uniform-router/file/go-client/cmd/client.go" />
<package value="github.com/apache/dubbo-go-samples/router/uniform-router/zookeeper/go-client/cmd" />
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
</component>
15 changes: 15 additions & 0 deletions .run/router-server (1).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="router-server (1)" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="router-zk">
<module name="dubbo-go-samples" />
<working_directory value="$PROJECT_DIR$" />
<envs>
<env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/router/uniform-router/zookeeper/go-server/conf/log.yml" />
<env name="CONF_PROVIDER_FILE_PATH" value="$PROJECT_DIR$/router/uniform-router/zookeeper/go-server/conf/server.yml" />
</envs>
<kind value="PACKAGE" />
<filePath value="$PROJECT_DIR$/router/uniform-router/file/go-server2/cmd/server.go" />
<package value="github.com/apache/dubbo-go-samples/router/uniform-router/zookeeper/go-server/cmd" />
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
</component>
15 changes: 15 additions & 0 deletions .run/router-server2 (1).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="router-server2 (1)" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="router-zk">
<module name="dubbo-go-samples" />
<working_directory value="$PROJECT_DIR$" />
<envs>
<env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/router/uniform-router/zookeeper/go-server2/conf/log.yml" />
<env name="CONF_PROVIDER_FILE_PATH" value="$PROJECT_DIR$/router/uniform-router/zookeeper/go-server2/conf/server.yml" />
</envs>
<kind value="PACKAGE" />
<filePath value="$PROJECT_DIR$/router/uniform-router/file/go-server2/cmd/server.go" />
<package value="github.com/apache/dubbo-go-samples/router/uniform-router/zookeeper/go-server2/cmd" />
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
</component>
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/apache/dubbo-go-samples

require (
dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20210705181411-e43af85126fd
dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20210708063655-af290429dee4
github.com/alibaba/sentinel-golang v1.0.2
github.com/apache/dubbo-getty v1.4.3
github.com/apache/dubbo-go-hessian2 v1.9.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiy
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20210705181411-e43af85126fd h1:osLG5U8sKqWKyQnw4hIsQZSBKThYkRKWZ4BcCAA737A=
dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20210705181411-e43af85126fd/go.mod h1:2l+IXuSuJvEk2g/ze1la8t1sX+yJH220aHo6JJVriM8=
dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20210708063655-af290429dee4 h1:JRGjw66CguqaOeYigLauTdccWqnvy7U3OYqAHzXYmlw=
dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20210708063655-af290429dee4/go.mod h1:2l+IXuSuJvEk2g/ze1la8t1sX+yJH220aHo6JJVriM8=
github.com/Azure/azure-sdk-for-go v40.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest v0.9.3/go.mod h1:GsRuLYvwzLjjjRoWEIyMUaYq8GNUx2nRB378IPt/1p0=
Expand Down
3 changes: 2 additions & 1 deletion registry/servicediscovery/nacos/go-client/cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ import (
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/config_center/nacos"
_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory"
_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/dynamic"
_ "dubbo.apache.org/dubbo-go/v3/metadata/report/nacos"
_ "dubbo.apache.org/dubbo-go/v3/metadata/service/local"
_ "dubbo.apache.org/dubbo-go/v3/metadata/service/remote"
Expand Down
6 changes: 5 additions & 1 deletion registry/servicediscovery/nacos/go-client/conf/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ request_timeout: "3s"
# connect timeout
connect_timeout: "3s"

# config center config
config_center:
protocol: "nacos"
address: "127.0.0.1:8848"

# application config
application:
organization: "dubbo.io"
Expand Down Expand Up @@ -42,7 +47,6 @@ service_discovery:
references:
"UserProvider":
registry: "demoServiceDiscovery"
provided_by: "UserInfoServer"
protocol: "dubbo"
interface: "org.apache.dubbo.UserProvider"
cluster: "failover"
Expand Down
33 changes: 0 additions & 33 deletions registry/servicediscovery/nacos/go-client/conf/server.yml

This file was deleted.

10 changes: 5 additions & 5 deletions registry/servicediscovery/nacos/go-server/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ import (

import (
hessian "github.com/apache/dubbo-go-hessian2"
"github.com/apache/dubbo-go-samples/registry/servicediscovery/nacos/go-server/pkg"
)

import (
_ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl"
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
"dubbo.apache.org/dubbo-go/v3/common/logger"
_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/config_center/nacos"
_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory"
_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/dynamic"
_ "dubbo.apache.org/dubbo-go/v3/metadata/report/nacos"
_ "dubbo.apache.org/dubbo-go/v3/metadata/service/remote"
_ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo"
Expand All @@ -44,10 +48,6 @@ import (
_ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery"
)

import (
"github.com/apache/dubbo-go-samples/registry/servicediscovery/nacos/go-server/pkg"
)

var (
survivalTimeout = int(3e9)
)
Expand Down
6 changes: 5 additions & 1 deletion registry/servicediscovery/nacos/go-server/conf/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ request_timeout: "3s"
# connect timeout
connect_timeout: "3s"

# config center config
config_center:
protocol: "nacos"
address: "127.0.0.1:8848"

# application config
application:
organization: "dubbo.io"
Expand Down Expand Up @@ -42,7 +47,6 @@ service_discovery:
references:
"UserProvider":
registry: "demoServiceDiscovery"
provided_by: "UserInfoServer"
protocol: "dubbo"
interface: "org.apache.dubbo.UserProvider"
cluster: "failover"
Expand Down
5 changes: 5 additions & 0 deletions registry/servicediscovery/nacos/go-server/conf/server.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# dubbo server yaml configure file

# config center config
config_center:
protocol: "nacos"
address: "127.0.0.1:8848"

# application config
application:
organization: "dubbo.io"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import (
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/config_center/nacos"
_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory"
_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/dynamic"
_ "dubbo.apache.org/dubbo-go/v3/metadata/report/nacos"
_ "dubbo.apache.org/dubbo-go/v3/metadata/service/local"
_ "dubbo.apache.org/dubbo-go/v3/metadata/service/remote"
Expand Down
3 changes: 2 additions & 1 deletion registry/servicediscovery/zookeeper/go-client/cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ import (
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/config_center/zookeeper"
_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory"
_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/dynamic"
_ "dubbo.apache.org/dubbo-go/v3/metadata/report/zookeeper"
_ "dubbo.apache.org/dubbo-go/v3/metadata/service/local"
_ "dubbo.apache.org/dubbo-go/v3/metadata/service/remote"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ request_timeout: "3s"
# connect timeout
connect_timeout: "3s"

# config center config
config_center:
protocol: "zookeeper"
address: "127.0.0.1:2181"

# application config
application:
organization: "dubbo.io"
Expand Down Expand Up @@ -41,7 +46,6 @@ service_discovery:
references:
"UserProvider":
registry: "demoServiceDiscovery"
provided_by: "UserInfoServer"
protocol: "dubbo"
interface: "org.apache.dubbo.UserProvider"
cluster: "failover"
Expand Down
13 changes: 7 additions & 6 deletions registry/servicediscovery/zookeeper/go-server/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,27 @@ import (
"time"
)

import (
hessian "github.com/apache/dubbo-go-hessian2"
"github.com/apache/dubbo-go-samples/registry/servicediscovery/zookeeper/go-server/pkg"
)

import (
_ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl"
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
"dubbo.apache.org/dubbo-go/v3/common/logger"
_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/config_center/zookeeper"
_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory"
_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/dynamic"
_ "dubbo.apache.org/dubbo-go/v3/metadata/report/zookeeper"
_ "dubbo.apache.org/dubbo-go/v3/metadata/service/remote"
_ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo"
_ "dubbo.apache.org/dubbo-go/v3/protocol/jsonrpc"
_ "dubbo.apache.org/dubbo-go/v3/registry/protocol"
_ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery"
_ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper"
hessian "github.com/apache/dubbo-go-hessian2"
)

import (
"github.com/apache/dubbo-go-samples/registry/servicediscovery/zookeeper/go-server/pkg"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ request_timeout: "3s"
# connect timeout
connect_timeout: "3s"

# config center config
config_center:
protocol: "zookeeper"
address: "127.0.0.1:2181"

# application config
application:
organization: "dubbo.io"
Expand Down Expand Up @@ -41,7 +46,6 @@ service_discovery:
references:
"UserProvider":
registry: "demoServiceDiscovery"
provided_by: "UserInfoServer"
protocol: "dubbo"
interface: "org.apache.dubbo.UserProvider"
cluster: "failover"
Expand Down
4 changes: 4 additions & 0 deletions registry/servicediscovery/zookeeper/go-server/conf/server.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# dubbo server yaml configure file
# config center config
config_center:
protocol: "zookeeper"
address: "127.0.0.1:2181"

# application config
application:
Expand Down
5 changes: 1 addition & 4 deletions registry/servicediscovery/zookeeper/go-server/pkg/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ import (
"time"
)

import (
"github.com/dubbogo/gost/log"
)

import (
"dubbo.apache.org/dubbo-go/v3/config"
hessian "github.com/apache/dubbo-go-hessian2"
"github.com/dubbogo/gost/log"
)

func init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ import (
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/config_center/zookeeper"
_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory"
_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/dynamic"
_ "dubbo.apache.org/dubbo-go/v3/metadata/report/zookeeper"
_ "dubbo.apache.org/dubbo-go/v3/metadata/service/local"
_ "dubbo.apache.org/dubbo-go/v3/metadata/service/remote"
Expand Down

0 comments on commit c875ae7

Please sign in to comment.