Skip to content

Commit

Permalink
Merge branch 'develop' into feature/cli-support
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenceLiZhixin committed Jan 26, 2021
2 parents 2d6c611 + 9d0769f commit 4776f65
Show file tree
Hide file tree
Showing 24 changed files with 261 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
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
17 changes: 17 additions & 0 deletions common/extension/metadata_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"))
}
9 changes: 8 additions & 1 deletion config/reference_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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() {
Expand Down
7 changes: 7 additions & 0 deletions config/service_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ func (c *ServiceConfig) Export() error {
}
c.exporters = append(c.exporters, exporter)
}
publishServiceDefinition(ivkURL)
}
c.exported.Store(true)
return nil
Expand Down Expand Up @@ -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() {
Expand Down
Loading

0 comments on commit 4776f65

Please sign in to comment.