diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml
index 40ef43c8c125fdcad481f1436e64006149ca3611..a20fb8d48bb5e65e8ec1113c60dcb12e8f0393b5 100644
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@ -71,7 +71,7 @@ jobs:
- name: Integrate Test
run: |
- chmod +x integrate_test.sh && ./integrate_test.sh
+ chmod +x integrate_test.sh && ./integrate_test.sh ${{github.event.pull_request.head.repo.full_name}} ${{github.event.pull_request.head.sha}}
- name: Post Coverage
run: bash <(curl -s https://codecov.io/bash)
diff --git a/README.md b/README.md
index 8af021bb079f47939e5f3d69037906a0c0587d56..c77a0b47665db4d82064714426995834e6a778d0 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@

---
+
Apache Dubbo Go Implementation.
@@ -134,25 +135,17 @@ Finished List:
* [Zookeeper](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/zookeeper/service_discovery.go)
* [Etcd](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/etcdv3/service_discovery.go)
-- Others:
- * start check
- * connecting certain provider
- * multi-protocols
- * multi-registries
- * multi-versions
- * service group
-
You can know more about dubbo-go by its [roadmap](https://github.com/apache/dubbo-go/wiki/Roadmap).

## Document
-https://dubbogo.github.io/dubbo-go-website (**Improving**)
+[dubbo-doc](http://dubbo.apache.org/zh/blog/) or [dubbo-go-doc-list](http://alexstocks.github.io/html/dubbogo.html)
## Quick Start
-[dubbo-go-samples](https://github.com/apache/dubbo-go-samples) shows how to use dubbo-go. Please read the [dubbo-samples/golang/README.md](https://github.com/apache/dubbo-go-samples/blob/master/README.md) carefully to learn how to dispose the configuration and compile the program.
+[dubbo-go-samples](https://github.com/apache/dubbo-go-samples) gives many examples to tell u how to use dubbo-go. Please read the [dubbo-samples/golang/README.md](https://github.com/apache/dubbo-go-samples/blob/master/README.md) carefully to learn how to dispose the configuration and compile the program.
## Running unit tests
@@ -182,6 +175,17 @@ Please move to [dubbo-samples/golang](https://github.com/dubbogo/dubbo-samples)
If you are willing to do some code contributions and document contributions to [Apache/dubbo-go](https://github.com/apache/dubbo-go), please visit [contribution intro](https://github.com/apache/dubbo-go/blob/master/contributing.md).
+## Community
+
+If u want to communicate with our community, pls scan the following [dubbobo Ding-Ding QR code](https://mmbiz.qpic.cn/mmbiz_jpg/yvBJb5IiafvnHVBdtia30dxA2hKotr9DEckWsZ7aOJcDWDaSVMGwLmYv8GRgIQtqb4C2svicp8nVkMmGy7yKC5tyA/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1) or search our commnity DingDing group code 31363295.
+
+<a href="http://alexstocks.github.io/html/dubbogo.html">
+<img src="./doc/pic/misc/dubbogo-dingding.png" height="80" width="80"></a>
+
+If u want to visit the wechat group, pls add my wechat AlexanderStocks.
+
+We welcome the friends who can give us constructing suggestions instead of known-nothing.
+
## Benchmark
Benchmark project [dubbo-go-benchmark](https://github.com/dubbogo/dubbo-go-benchmark).
@@ -259,6 +263,11 @@ If you are using [apache/dubbo-go](github.com/apache/dubbo-go) and think that it
<img width="222px" src="https://ugc.hitv.com/platform_oss/F6077F1AA82542CDBDD88FD518E6E727.png">
</a>
</td>
+ <td align="center" valign="middle">
+ <a href="http://www.dmall.com" target="_blank">
+ <img width="222px" src="https://mosn.io/images/community/duodian.png">
+ </a>
+ </td>
</tr>
<tr></tr>
</tbody>
diff --git a/README_CN.md b/README_CN.md
index 079cfa57449734f291ab5252ed86b01ac59c542c..725db288180fd64e7a8a86b1b0154a36b1f1da5e 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -133,25 +133,17 @@ Apache License, Version 2.0
* [Zookeeper](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/zookeeper/service_discovery.go)
* [Etcd](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/etcdv3/service_discovery.go)
-- 其他功能支持:
- * 启动时检查
- * 服务直连
- * 多服务协议
- * 多注册中心
- * 多服务版本
- * 服务分组
-
你可以通过访问 [roadmap](https://github.com/apache/dubbo-go/wiki/Roadmap) 知道更多关于 dubbo-go 的信息。

## 文档
-https://dubbogo.github.io/dubbo-go-website (**完善中**)
+请访问 [dubbo官方文档中关于 dubbo-go 的系列文档](http://dubbo.apache.org/zh/blog/) 或 [过往dubbo-go文档列表](http://alexstocks.github.io/html/dubbogo.html)。
## 快速开始 ##
-[dubbo-samples/golang](https://github.com/dubbogo/dubbo-samples)这个项目的事例展示了如何使用 dubbo-go 。请仔细阅读 [dubbo-samples/golang/README.md](https://github.com/dubbogo/dubbo-samples/blob/master/golang/README.md) 学习如何处理配置并编译程序。
+[dubbo-samples/golang](https://github.com/apache/dubbo-go-samples)这个项目的事例展示了如何使用 dubbo-go 。请仔细阅读 [dubbo-samples/golang/README.md](https://github.com/apache/dubbo-go-samples/blob/master/README.md) 学习如何处理配置并编译程序。
## 运行单测
@@ -181,6 +173,17 @@ make test
如果您愿意给 [Apache/dubbo-go](https://github.com/apache/dubbo-go) 贡献代码或者文档,我们都热烈欢迎。具体请参考 [contribution intro](https://github.com/apache/dubbo-go/blob/master/contributing.md)。
+## 社区
+
+如果想访问官方钉钉群,请在钉钉中搜索社区群号 31363295 或者 扫描如下[二维码](https://mmbiz.qpic.cn/mmbiz_jpg/yvBJb5IiafvnHVBdtia30dxA2hKotr9DEckWsZ7aOJcDWDaSVMGwLmYv8GRgIQtqb4C2svicp8nVkMmGy7yKC5tyA/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1)。
+
+<a href="http://alexstocks.github.io/html/dubbogo.html">
+<img src="./doc/pic/misc/dubbogo-dingding.png" height="80" width="80"></a>
+
+如果想加入到社区微信群,可以先添加社区负责人 于雨 的微信 AlexanderStocks 。添加微信之前,请先给 dubbo-go 点 star 作为对项目的支持,添加好友时请报上 github ID 以进行验证。
+
+作为一个维护已经帮助构建了经受多家大型微服务系统的社区,我们足以为现有的成绩感到自豪。社区欢迎能提出建设性意见者,只知索取者和喷子请绕行。
+
## 性能测试 ##
性能测试项目是 [dubbo-go-benchmark](https://github.com/dubbogo/dubbo-go-benchmark)。
@@ -256,6 +259,11 @@ make test
<a href="http://www.mgtv.com" target="_blank">
<img width="222px" src="https://ugc.hitv.com/platform_oss/F6077F1AA82542CDBDD88FD518E6E727.png">
</a>
+ </td>
+ <td align="center" valign="middle">
+ <a href="http://www.dmall.com" target="_blank">
+ <img width="222px" src="https://mosn.io/images/community/duodian.png">
+ </a>
</td>
</tr>
<tr></tr>
diff --git a/common/constant/key.go b/common/constant/key.go
index 50aea81371bfc8b189e80f19a5c17c5d9de7ae51..0515094f285a4bf598b04e2ea1ef376325de7ac1 100644
--- a/common/constant/key.go
+++ b/common/constant/key.go
@@ -173,6 +173,7 @@ const (
NACOS_NAMESPACE_ID = "namespaceId"
NACOS_PASSWORD = "password"
NACOS_USERNAME = "username"
+ NACOS_NOT_LOAD_LOCAL_CACHE = "nacos.not.load.cache"
)
const (
diff --git a/common/extension/metadata_service.go b/common/extension/metadata_service.go
index e35677d148eee121c3a6c018a128b5d372c6f2c7..08ddbc333e85fbfc328bec15aa76d2a588b11afb 100644
--- a/common/extension/metadata_service.go
+++ b/common/extension/metadata_service.go
@@ -26,12 +26,15 @@ import (
)
import (
+ "github.com/apache/dubbo-go/common/logger"
"github.com/apache/dubbo-go/metadata/service"
)
var (
// there will be two types: local or remote
metadataServiceInsMap = make(map[string]func() (service.MetadataService, error), 2)
+ // remoteMetadataService
+ remoteMetadataService service.MetadataService
)
// SetMetadataService will store the msType => creator pair
@@ -48,3 +51,17 @@ func GetMetadataService(msType string) (service.MetadataService, error) {
"local - github.com/apache/dubbo-go/metadata/service/inmemory, \n"+
"remote - github.com/apache/dubbo-go/metadata/service/remote", msType))
}
+
+// GetRemoteMetadataService will get a RemoteMetadataService instance
+func GetRemoteMetadataService() (service.MetadataService, error) {
+ if remoteMetadataService != nil {
+ return remoteMetadataService, nil
+ }
+ if creator, ok := metadataServiceInsMap["remote"]; ok {
+ var err error
+ remoteMetadataService, err = creator()
+ return remoteMetadataService, err
+ }
+ logger.Warn("could not find the metadata service creator for metadataType: remote")
+ return nil, perrors.New(fmt.Sprintf("could not find the metadata service creator for metadataType: remote"))
+}
diff --git a/config/reference_config.go b/config/reference_config.go
index 431ec0e2eb3c03b27cca40acd7b721cf6b8f9755..895ab9df26399c1c9a1296e44fba8a284ba2fb6c 100644
--- a/config/reference_config.go
+++ b/config/reference_config.go
@@ -167,7 +167,8 @@ func (c *ReferenceConfig) Refer(_ interface{}) {
// FailoverClusterInvoker(RegistryDirectory, routing happens here) -> Invoker
c.invoker = cluster.Join(directory.NewStaticDirectory(invokers))
}
-
+ // publish consumer metadata
+ publishConsumerDefinition(cfgURL)
// create proxy
if c.Async {
callback := GetCallback(c.id)
@@ -257,6 +258,12 @@ func (c *ReferenceConfig) GenericLoad(id string) {
c.Implement(genericService)
}
+func publishConsumerDefinition(url *common.URL) {
+ if remoteMetadataService, err := extension.GetRemoteMetadataService(); err == nil && remoteMetadataService != nil {
+ remoteMetadataService.PublishServiceDefinition(url)
+ }
+}
+
// postProcessConfig asks registered ConfigPostProcessor to post-process the current ReferenceConfig.
func (c *ReferenceConfig) postProcessConfig(url *common.URL) {
for _, p := range extension.GetConfigPostProcessors() {
diff --git a/config/service_config.go b/config/service_config.go
index fd49390aa2b15938a8a4aa321d47ceafef4d9be9..e8523bdea7aa014836580b7ce33fe215c145289d 100644
--- a/config/service_config.go
+++ b/config/service_config.go
@@ -234,6 +234,7 @@ func (c *ServiceConfig) Export() error {
}
c.exporters = append(c.exporters, exporter)
}
+ publishServiceDefinition(ivkURL)
}
c.exported.Store(true)
return nil
@@ -347,6 +348,12 @@ func (c *ServiceConfig) GetExportedUrls() []*common.URL {
return nil
}
+func publishServiceDefinition(url *common.URL) {
+ if remoteMetadataService, err := extension.GetRemoteMetadataService(); err == nil && remoteMetadataService != nil {
+ remoteMetadataService.PublishServiceDefinition(url)
+ }
+}
+
// postProcessConfig asks registered ConfigPostProcessor to post-process the current ServiceConfig.
func (c *ServiceConfig) postProcessConfig(url *common.URL) {
for _, p := range extension.GetConfigPostProcessors() {
diff --git a/doc/pic/misc/dubbogo-dingding.png b/doc/pic/misc/dubbogo-dingding.png
new file mode 100644
index 0000000000000000000000000000000000000000..dc27d4ecce94a095e2eb70f97446c76c5b8537da
Binary files /dev/null and b/doc/pic/misc/dubbogo-dingding.png differ
diff --git a/filter/filter_impl/sentinel_filter.go b/filter/filter_impl/sentinel_filter.go
index f662db35637593f4ab92a2b12e50d5a9e4305730..1de27adbac1808dbbbf8017f0119077752191d6f 100644
--- a/filter/filter_impl/sentinel_filter.go
+++ b/filter/filter_impl/sentinel_filter.go
@@ -42,6 +42,7 @@ import (
// 1. Must initialize Sentinel Go run environment,
// refer to https://github.com/alibaba/sentinel-golang/blob/master/api/init.go
// 2. Register rules for resources user want to guard
+
func init() {
extension.SetFilter(SentinelProviderFilterName, GetSentinelProviderFilter)
extension.SetFilter(SentinelConsumerFilterName, GetSentinelConsumerFilter)
diff --git a/go.mod b/go.mod
index 7e76ae85f6bd007234c42b66bb372ffb6502b55b..2dda6cffad082dac4986d318277913c980203d55 100644
--- a/go.mod
+++ b/go.mod
@@ -1,5 +1,7 @@
module github.com/apache/dubbo-go
+go 1.13
+
require (
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/RoaringBitmap/roaring v0.5.5
@@ -11,7 +13,7 @@ require (
github.com/coreos/etcd v3.3.25+incompatible
github.com/creasty/defaults v1.5.1
github.com/dubbogo/go-zookeeper v1.0.2
- github.com/dubbogo/gost v1.10.1
+ github.com/dubbogo/gost v1.11.0
github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
github.com/emicklei/go-restful/v3 v3.4.0
github.com/frankban/quicktest v1.4.1 // indirect
@@ -28,9 +30,9 @@ require (
github.com/hashicorp/vault/sdk v0.1.14-0.20191112033314-390e96e22eb2
github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8
github.com/magiconair/properties v1.8.4
- github.com/mitchellh/mapstructure v1.4.0
+ github.com/mitchellh/mapstructure v1.4.1
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
- github.com/nacos-group/nacos-sdk-go v1.0.3
+ github.com/nacos-group/nacos-sdk-go v1.0.5
github.com/opentracing/opentracing-go v1.2.0
github.com/pierrec/lz4 v2.2.6+incompatible // indirect
github.com/pkg/errors v0.9.1
diff --git a/go.sum b/go.sum
index 00f7deeed3f4a69f7f77e40b16344b4ff6240913..6cc41e6b583077ffa0e48d70d7d840831d5561a6 100644
--- a/go.sum
+++ b/go.sum
@@ -176,6 +176,8 @@ github.com/dubbogo/go-zookeeper v1.0.2/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4D
github.com/dubbogo/gost v1.9.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
github.com/dubbogo/gost v1.10.1 h1:39kF9Cd5JOiMpmwG6dX1/aLWNFqFv9gHp8HrhzMmjLY=
github.com/dubbogo/gost v1.10.1/go.mod h1:+mQGS51XQEUWZP2JeGZTxJwipjRKtJO7Tr+FOg+72rI=
+github.com/dubbogo/gost v1.11.0 h1:9KtyWQz1gMlAfwzen5iyhMdoe08SPBBUVhco4rdgJ9I=
+github.com/dubbogo/gost v1.11.0/go.mod h1:w8Yw29eDWtRVo3tx9nPpHkNZnOi4SRx1fZf7eVlAAU4=
github.com/dubbogo/jsonparser v1.0.1/go.mod h1:tYAtpctvSP/tWw4MeelsowSPgXQRVHHWbqL6ynps8jU=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
@@ -474,7 +476,9 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
+github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM=
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
+github.com/k0kubun/pp v3.0.1+incompatible h1:3tqvf7QgUnZ5tXO6pNAZlrvHgl6DvifjDrd9g2S9Z40=
github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
@@ -546,8 +550,8 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.2.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
-github.com/mitchellh/mapstructure v1.4.0 h1:7ks8ZkOP5/ujthUsT07rNv+nkLXCQWKNHuwzOAesEks=
-github.com/mitchellh/mapstructure v1.4.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
+github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
+github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/pointerstructure v1.0.0 h1:ATSdz4NWrmWPOF1CeCBU4sMCno2hgqdbSrRPFWQSVZI=
github.com/mitchellh/pointerstructure v1.0.0/go.mod h1:k4XwG94++jLVsSiTxo7qdIfXA9pj9EAeo0QsNNJOLZ8=
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
@@ -566,8 +570,8 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
-github.com/nacos-group/nacos-sdk-go v1.0.3 h1:A2tCWcjuP6bSEjEfNwNnrY+9M0h13XRMDyLY+DPqHMI=
-github.com/nacos-group/nacos-sdk-go v1.0.3/go.mod h1:hlAPn3UdzlxIlSILAyOXKxjFSvDJ9oLzTJ9hLAK1KzA=
+github.com/nacos-group/nacos-sdk-go v1.0.5 h1:xwLS0Ao7fSB3HoDFR+JRZ1fh0HuvgHPOWBdals37Oxc=
+github.com/nacos-group/nacos-sdk-go v1.0.5/go.mod h1:hlAPn3UdzlxIlSILAyOXKxjFSvDJ9oLzTJ9hLAK1KzA=
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
diff --git a/integrate_test.sh b/integrate_test.sh
index deccda756a211821978e35b92a1f0865858ff59a..e1bbc8c11b0195f7cc4f08946d57464c88e74f19 100644
--- a/integrate_test.sh
+++ b/integrate_test.sh
@@ -26,12 +26,12 @@ ROOT_DIR=$(pwd)
echo "integrate-test root work-space -> ${ROOT_DIR}"
# show all travis-env
-echo "travis current commit id -> ${TRAVIS_COMMIT}"
-echo "travis pull request -> ${TRAVIS_PULL_REQUEST}"
-echo "travis pull request branch -> ${TRAVIS_PULL_REQUEST_BRANCH}"
-echo "travis pull request slug -> ${TRAVIS_PULL_REQUEST_SLUG}"
-echo "travis pull request sha -> ${TRAVIS_PULL_REQUEST_SHA}"
-echo "travis pull request repo slug -> ${TRAVIS_REPO_SLUG}"
+echo "travis current commit id -> $2"
+echo "travis pull request branch -> ${GITHUB_REF}"
+echo "travis pull request slug -> ${GITHUB_REPOSITORY}"
+echo "travis pull request repo slug -> ${GITHUB_REPOSITORY}"
+echo "travis pull request actor -> ${GITHUB_ACTOR}"
+echo "travis pull request repo param -> $1"
# #start etcd registry insecure listen in [:]:2379
@@ -53,13 +53,13 @@ echo "zookeeper listen in [:]2181"
# build go-server image
cd ./test/integrate/dubbo/go-server
-docker build . -t ci-provider --build-arg PR_ORIGIN_REPO=${TRAVIS_PULL_REQUEST_SLUG} --build-arg PR_ORIGIN_COMMITID=${TRAVIS_PULL_REQUEST_SHA}
+docker build . -t ci-provider --build-arg PR_ORIGIN_REPO=$1 --build-arg PR_ORIGIN_COMMITID=$2
cd ${ROOT_DIR}
docker run -d --network host ci-provider
# build go-client image
cd ./test/integrate/dubbo/go-client
-docker build . -t ci-consumer --build-arg PR_ORIGIN_REPO=${TRAVIS_PULL_REQUEST_SLUG} --build-arg PR_ORIGIN_COMMITID=${TRAVIS_PULL_REQUEST_SHA}
+docker build . -t ci-consumer --build-arg PR_ORIGIN_REPO=$1 --build-arg PR_ORIGIN_COMMITID=$2
cd ${ROOT_DIR}
# run provider
# check consumer status
diff --git a/metadata/report/delegate/delegate_report.go b/metadata/report/delegate/delegate_report.go
index f364087fdc8c2fb2a595190d7ca0d9564ac5d171..56a22de8f8e56c040260edf86859a4499f1b2f39 100644
--- a/metadata/report/delegate/delegate_report.go
+++ b/metadata/report/delegate/delegate_report.go
@@ -109,6 +109,10 @@ type MetadataReport struct {
// NewMetadataReport will create a MetadataReport with initiation
func NewMetadataReport() (*MetadataReport, error) {
url := instance.GetMetadataReportUrl()
+ if url == nil {
+ logger.Warn("the metadataReport URL is not configured, you should configure it.")
+ return nil, perrors.New("the metadataReport URL is not configured, you should configure it.")
+ }
bmr := &MetadataReport{
reportUrl: url,
syncReport: url.GetParamBool(constant.SYNC_REPORT_KEY, false),
diff --git a/metadata/service/remote/service.go b/metadata/service/remote/service.go
index d21cc88a3d31ec2920a78c608ed13a491fd6c634..bb520d3df72c369eb4022246f20bb9e9aa1bd8b8 100644
--- a/metadata/service/remote/service.go
+++ b/metadata/service/remote/service.go
@@ -116,22 +116,40 @@ func (mts *MetadataService) UnsubscribeURL(url *common.URL) error {
func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error {
interfaceName := url.GetParam(constant.INTERFACE_KEY, "")
isGeneric := url.GetParamBool(constant.GENERIC_KEY, false)
- if len(interfaceName) > 0 && !isGeneric {
- sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey())
- sd := definition.BuildServiceDefinition(*sv, url)
+ if common.RoleType(common.PROVIDER).Role() == url.GetParam(constant.SIDE_KEY, "") {
+ if len(interfaceName) > 0 && !isGeneric {
+ sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey())
+ sd := definition.BuildServiceDefinition(*sv, url)
+ id := &identifier.MetadataIdentifier{
+ BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{
+ ServiceInterface: interfaceName,
+ Version: url.GetParam(constant.VERSION_KEY, ""),
+ Group: url.GetParam(constant.GROUP_KEY, constant.DUBBO),
+ Side: url.GetParam(constant.SIDE_KEY, constant.PROVIDER_PROTOCOL),
+ },
+ }
+ mts.delegateReport.StoreProviderMetadata(id, sd)
+ return nil
+ }
+ logger.Errorf("publishProvider interfaceName is empty . providerUrl:%v ", url)
+ } else {
+ params := make(map[string]string, len(url.GetParams()))
+ url.RangeParams(func(key, value string) bool {
+ params[key] = value
+ return true
+ })
id := &identifier.MetadataIdentifier{
BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{
ServiceInterface: interfaceName,
Version: url.GetParam(constant.VERSION_KEY, ""),
- // Group: url.GetParam(constant.GROUP_KEY, constant.SERVICE_DISCOVERY_DEFAULT_GROUP),
- Group: url.GetParam(constant.GROUP_KEY, constant.DUBBO),
- Side: url.GetParam(constant.SIDE_KEY, "provider"),
+ Group: url.GetParam(constant.GROUP_KEY, constant.DUBBO),
+ Side: url.GetParam(constant.SIDE_KEY, "consumer"),
},
}
- mts.delegateReport.StoreProviderMetadata(id, sd)
+ mts.delegateReport.StoreConsumerMetadata(id, params)
return nil
}
- logger.Errorf("publishProvider interfaceName is empty . providerUrl:%v ", url)
+
return nil
}
diff --git a/protocol/protocolwrapper/protocol_filter_wrapper.go b/protocol/protocolwrapper/protocol_filter_wrapper.go
index 79d2cf7f55ee81db39ea28448fc66a8a7494d8d1..679036f20e941866652bff3bf28bc75f690908c8 100644
--- a/protocol/protocolwrapper/protocol_filter_wrapper.go
+++ b/protocol/protocolwrapper/protocol_filter_wrapper.go
@@ -77,7 +77,7 @@ func buildInvokerChain(invoker protocol.Invoker, key string) protocol.Invoker {
// The order of filters is from left to right, so loading from right to left
next := invoker
for i := len(filterNames) - 1; i >= 0; i-- {
- flt := extension.GetFilter(filterNames[i])
+ flt := extension.GetFilter(strings.TrimSpace(filterNames[i]))
fi := &FilterInvoker{next: next, invoker: invoker, filter: flt}
next = fi
}
diff --git a/protocol/protocolwrapper/protocol_filter_wrapper_test.go b/protocol/protocolwrapper/protocol_filter_wrapper_test.go
index 8f063f85521bbdcd3fa3891e7d09754fc9b58ac7..b37d066f03c8084d2d529217567c1ede940a5491 100644
--- a/protocol/protocolwrapper/protocol_filter_wrapper_test.go
+++ b/protocol/protocolwrapper/protocol_filter_wrapper_test.go
@@ -42,7 +42,7 @@ func TestProtocolFilterWrapperExport(t *testing.T) {
u := common.NewURLWithOptions(
common.WithParams(url.Values{}),
- common.WithParamsValue(constant.SERVICE_FILTER_KEY, "echo"))
+ common.WithParamsValue(constant.SERVICE_FILTER_KEY, "echo "))
exporter := filtProto.Export(protocol.NewBaseInvoker(u))
_, ok := exporter.GetInvoker().(*FilterInvoker)
assert.True(t, ok)
@@ -54,7 +54,7 @@ func TestProtocolFilterWrapperRefer(t *testing.T) {
u := common.NewURLWithOptions(
common.WithParams(url.Values{}),
- common.WithParamsValue(constant.REFERENCE_FILTER_KEY, "echo"))
+ common.WithParamsValue(constant.REFERENCE_FILTER_KEY, " echo"))
invoker := filtProto.Refer(u)
_, ok := invoker.(*FilterInvoker)
assert.True(t, ok)
diff --git a/registry/etcdv3/listener.go b/registry/etcdv3/listener.go
index 4bc387cafaa3c64539efb29a181a2198fbe8a30f..f900495f97d3acfd9a2ae232264910b791961bc8 100644
--- a/registry/etcdv3/listener.go
+++ b/registry/etcdv3/listener.go
@@ -19,6 +19,7 @@ package etcdv3
import (
"strings"
+ "sync"
)
import (
@@ -79,8 +80,9 @@ func (l *dataListener) DataChange(eventType remoting.Event) bool {
}
type configurationListener struct {
- registry *etcdV3Registry
- events chan *config_center.ConfigChangeEvent
+ registry *etcdV3Registry
+ events chan *config_center.ConfigChangeEvent
+ closeOnce sync.Once
}
// NewConfigurationListener for listening the event of etcdv3.
@@ -120,5 +122,7 @@ func (l *configurationListener) Next() (*registry.ServiceEvent, error) {
// Close etcd registry center
func (l *configurationListener) Close() {
- l.registry.WaitGroup().Done()
+ l.closeOnce.Do(func() {
+ l.registry.WaitGroup().Done()
+ })
}
diff --git a/registry/etcdv3/registry.go b/registry/etcdv3/registry.go
index f3cc379bd8e94b15b678f0ac1d5ed5b6c917da6a..7ccf32661c75ed4cd27fddd1fc020ded56066f37 100644
--- a/registry/etcdv3/registry.go
+++ b/registry/etcdv3/registry.go
@@ -51,7 +51,7 @@ type etcdV3Registry struct {
registry.BaseRegistry
cltLock sync.Mutex
client *etcdv3.Client
- listenerLock sync.Mutex
+ listenerLock sync.RWMutex
listener *etcdv3.EventListener
dataListener *dataListener
configListener *configurationListener
@@ -150,14 +150,9 @@ func (r *etcdV3Registry) CreatePath(k string) error {
// DoSubscribe actually subscribe the provider URL
func (r *etcdV3Registry) DoSubscribe(svc *common.URL) (registry.Listener, error) {
-
- var (
- configListener *configurationListener
- )
-
- r.listenerLock.Lock()
- configListener = r.configListener
- r.listenerLock.Unlock()
+ r.listenerLock.RLock()
+ configListener := r.configListener
+ r.listenerLock.RUnlock()
if r.listener == nil {
r.cltLock.Lock()
client := r.client
@@ -165,12 +160,8 @@ func (r *etcdV3Registry) DoSubscribe(svc *common.URL) (registry.Listener, error)
if client == nil {
return nil, perrors.New("etcd client broken")
}
-
- // new client & listener
- listener := etcdv3.NewEventListener(r.client)
-
r.listenerLock.Lock()
- r.listener = listener
+ r.listener = etcdv3.NewEventListener(r.client) // new client & listener
r.listenerLock.Unlock()
}
diff --git a/registry/nacos/registry.go b/registry/nacos/registry.go
index ae2345e6d5c90fcfc5c4dfb5b4da07bcf1b6f43e..de68e74906ecf14330d12bfb0ae42e86648ff9e3 100644
--- a/registry/nacos/registry.go
+++ b/registry/nacos/registry.go
@@ -274,7 +274,7 @@ func getNacosConfig(url *common.URL) (map[string]interface{}, error) {
Port: uint64(port),
})
}
- configMap["serverConfigs"] = serverConfigs
+ configMap[nacosConstant.KEY_SERVER_CONFIGS] = serverConfigs
var clientConfig nacosConstant.ClientConfig
timeout, err := time.ParseDuration(url.GetParam(constant.REGISTRY_TIMEOUT_KEY, constant.DEFAULT_REG_TIMEOUT))
@@ -287,8 +287,16 @@ func getNacosConfig(url *common.URL) (map[string]interface{}, error) {
clientConfig.LogDir = url.GetParam(constant.NACOS_LOG_DIR_KEY, "")
clientConfig.Endpoint = url.GetParam(constant.NACOS_ENDPOINT, "")
clientConfig.NamespaceId = url.GetParam(constant.NACOS_NAMESPACE_ID, "")
- clientConfig.NotLoadCacheAtStart = true
- configMap["clientConfig"] = clientConfig
+
+ //enable local cache when nacos can not connect.
+ notLoadCache, err := strconv.ParseBool(url.GetParam(constant.NACOS_NOT_LOAD_LOCAL_CACHE, "false"))
+ if err != nil {
+ logger.Errorf("ParseBool - error: %v", err)
+ notLoadCache = false
+ }
+ clientConfig.NotLoadCacheAtStart = notLoadCache
+
+ configMap[nacosConstant.KEY_CLIENT_CONFIG] = clientConfig
return configMap, nil
}
diff --git a/registry/nacos/registry_test.go b/registry/nacos/registry_test.go
index a852c00b14ac82ffc64206d6880c9f0e9af7aff6..b82820577144dfe98492165372a925500c20abfb 100644
--- a/registry/nacos/registry_test.go
+++ b/registry/nacos/registry_test.go
@@ -40,7 +40,11 @@ func TestNacosRegistry_Register(t *testing.T) {
if !checkNacosServerAlive() {
return
}
- regurl, _ := common.NewURL("registry://console.nacos.io:80", common.WithParamsValue(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER)))
+ regurlMap := url.Values{}
+ regurlMap.Set(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER))
+ regurlMap.Set(constant.NACOS_NOT_LOAD_LOCAL_CACHE, "true")
+ regurl, _ := common.NewURL("registry://console.nacos.io:80", common.WithParams(regurlMap))
+
urlMap := url.Values{}
urlMap.Set(constant.GROUP_KEY, "guangzhou-idc")
urlMap.Set(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER))
@@ -72,7 +76,11 @@ func TestNacosRegistry_Subscribe(t *testing.T) {
if !checkNacosServerAlive() {
return
}
- regurl, _ := common.NewURL("registry://console.nacos.io:80", common.WithParamsValue(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER)))
+ regurlMap := url.Values{}
+ regurlMap.Set(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER))
+ regurlMap.Set(constant.NACOS_NOT_LOAD_LOCAL_CACHE, "true")
+ regurl, _ := common.NewURL("registry://console.nacos.io:80", common.WithParams(regurlMap))
+
urlMap := url.Values{}
urlMap.Set(constant.GROUP_KEY, "guangzhou-idc")
urlMap.Set(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER))
@@ -113,7 +121,11 @@ func TestNacosRegistry_Subscribe_del(t *testing.T) {
if !checkNacosServerAlive() {
return
}
- regurl, _ := common.NewURL("registry://console.nacos.io:80", common.WithParamsValue(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER)))
+ regurlMap := url.Values{}
+ regurlMap.Set(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER))
+ regurlMap.Set(constant.NACOS_NOT_LOAD_LOCAL_CACHE, "true")
+ regurl, _ := common.NewURL("registry://console.nacos.io:80", common.WithParams(regurlMap))
+
urlMap := url.Values{}
urlMap.Set(constant.GROUP_KEY, "guangzhou-idc")
urlMap.Set(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER))
@@ -181,7 +193,11 @@ func TestNacosRegistry_Subscribe_del(t *testing.T) {
}
func TestNacosListener_Close(t *testing.T) {
- regurl, _ := common.NewURL("registry://console.nacos.io:80", common.WithParamsValue(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER)))
+ regurlMap := url.Values{}
+ regurlMap.Set(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER))
+ regurlMap.Set(constant.NACOS_NOT_LOAD_LOCAL_CACHE, "true")
+ regurl, _ := common.NewURL("registry://console.nacos.io:80", common.WithParams(regurlMap))
+
urlMap := url.Values{}
urlMap.Set(constant.GROUP_KEY, "guangzhou-idc")
urlMap.Set(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER))
diff --git a/registry/servicediscovery/service_discovery_registry.go b/registry/servicediscovery/service_discovery_registry.go
index 2ca4b8015bc8dbc51a47a46c1bec0301ac961339..c97a7f7b51d2344f1a3fc0c59582e089f1e63b62 100644
--- a/registry/servicediscovery/service_discovery_registry.go
+++ b/registry/servicediscovery/service_discovery_registry.go
@@ -174,10 +174,6 @@ func (s *serviceDiscoveryRegistry) Register(url *common.URL) error {
logger.Warnf("The URL[%s] has been registry!", url.String())
}
- err = s.metaDataService.PublishServiceDefinition(url)
- if err != nil {
- return perrors.WithMessage(err, "publish the service definition failed. ")
- }
return s.serviceNameMapping.Map(url.GetParam(constant.INTERFACE_KEY, ""),
url.GetParam(constant.GROUP_KEY, ""),
url.GetParam(constant.Version, ""),
diff --git a/remoting/etcdv3/listener.go b/remoting/etcdv3/listener.go
index c66928a6367cb2449de79a51b59d122a74a79911..fd6f9585979fabeb86d7a74d5817b6992b6a0ad4 100644
--- a/remoting/etcdv3/listener.go
+++ b/remoting/etcdv3/listener.go
@@ -36,7 +36,7 @@ import (
// nolint
type EventListener struct {
client *Client
- keyMapLock sync.Mutex
+ keyMapLock sync.RWMutex
keyMap map[string]struct{}
wg sync.WaitGroup
}
@@ -181,9 +181,9 @@ func timeSecondDuration(sec int) time.Duration {
// --------> listenServiceNodeEvent
func (l *EventListener) ListenServiceEvent(key string, listener remoting.DataListener) {
- l.keyMapLock.Lock()
+ l.keyMapLock.RLock()
_, ok := l.keyMap[key]
- l.keyMapLock.Unlock()
+ l.keyMapLock.RUnlock()
if ok {
logger.Warnf("etcdv3 key %s has already been listened.", key)
return