Skip to content

Commit

Permalink
Merge branch 'develop' into fix/metadata_fail
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexStocks authored Jan 23, 2021
2 parents b21ce4e + 9a666eb commit 9a980ff
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 35 deletions.
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
![license](https://img.shields.io/badge/license-Apache--2.0-green.svg)

---

Apache Dubbo Go Implementation.


Expand Down Expand Up @@ -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).

![feature](./doc/pic/arch/dubbo-go-arch.png)

## 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

Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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>
Expand Down
28 changes: 18 additions & 10 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 的信息。

![feature](./doc/pic/arch/dubbo-go-arch.png)

## 文档

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) 学习如何处理配置并编译程序。

## 运行单测

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions common/constant/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Binary file added doc/pic/misc/dubbogo-dingding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions filter/filter_impl/sentinel_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module github.com/apache/dubbo-go

go 1.15
go 1.13

require (
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/RoaringBitmap/roaring v0.5.5
github.com/Workiva/go-datastructures v1.0.52
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5
github.com/alibaba/sentinel-golang v1.0.1
github.com/alibaba/sentinel-golang v1.0.2
github.com/apache/dubbo-getty v1.4.1
github.com/apache/dubbo-go-hessian2 v1.8.2
github.com/coreos/etcd v3.3.25+incompatible
Expand Down Expand Up @@ -39,7 +39,7 @@ require (
github.com/prometheus/client_golang v1.8.0
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.6.1
github.com/stretchr/testify v1.7.0
github.com/zouyx/agollo/v3 v3.4.5
go.uber.org/atomic v1.7.0
go.uber.org/zap v1.16.0
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/alibaba/sentinel-golang v1.0.1 h1:WlhN0XUxRyfkiDc8TO6CcRrnakwFP9zFtvJTYxZRCgI=
github.com/alibaba/sentinel-golang v1.0.1/go.mod h1:QsB99f/z35D2AiMrAWwgWE85kDTkBUIkcmPrRt+61NI=
github.com/alibaba/sentinel-golang v1.0.2 h1:Acopq74hOtZN4MV1v811MQ6QcqPFLDSczTrRXv9zpIg=
github.com/alibaba/sentinel-golang v1.0.2/go.mod h1:QsB99f/z35D2AiMrAWwgWE85kDTkBUIkcmPrRt+61NI=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 h1:zOVTBdCKFd9JbCKz9/nt+FovbjPFmb7mUnp8nH9fQBA=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18/go.mod h1:v8ESoHo4SyHmuB4b1tJqDHxfTGEciD+yhvOU/5s1Rfk=
github.com/apache/dubbo-getty v1.4.1 h1:M9yaFhemThQSWtRwmJNrxNuv7FzydlFx5EY8oq1v+lw=
Expand Down Expand Up @@ -747,6 +747,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tebeka/strftime v0.1.3 h1:5HQXOqWKYRFfNyBMNVc9z5+QzuBtIXy03psIhtdJYto=
Expand Down
2 changes: 1 addition & 1 deletion protocol/protocolwrapper/protocol_filter_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions protocol/protocolwrapper/protocol_filter_wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
14 changes: 11 additions & 3 deletions registry/nacos/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
}
24 changes: 20 additions & 4 deletions registry/nacos/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 9a980ff

Please sign in to comment.