-
Notifications
You must be signed in to change notification settings - Fork 932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] Design and Implementation of dubbogo-contrib #2326
Comments
听起来不错,不过协议层做扩展形式可能会有些困难,尤其是triple协议 |
1、能不能在不破坏现有用户的使用方式的情况下,把 dubbogo 的所有扩展点定义单独抽出来成为一个单独的 dubbogo-extensions,所有的插件实现依赖 dubbogo-extensions |
我也觉得这个模式不错,可以先往这个方向探索 |
@chuntaojun @jasondeng1997 @mark4z 这个 issue 还是专注在仓库组织的讨论,中间可能涉及一些插件设计机制。 另外一块非常重要的,是关于 dubbo-go 启动加载流程这一块,需要分析出启动过程依赖哪些组件、详细的工作流程,咱们需要那块也同步的做起来,争取能真正在运行层面实现 dubbo-go 的轻量化,可以再起一个 issue 来单独跟进。 |
This is a place for various extensions in the dubbogo ecosystem that aren't part of the dubbogo core.
目前现状:
1.dubbogo中各个扩展都在一个包内,导致dubbogo目前主仓库臃肿
2.各个扩展麻烦,不易维护
3.对于dubbogo来说,这是一次极大的优化,无论是在性能和用户体验
1.设计方案
dubbogo已经通过社区开发者的支持,完成了 ETCD、ZooKeeper、Eureka、Consul、Nacos、Polaris 多种服务发现模式,当然也支持注册中心模式,建立起了强大且完备的社区生态,供用户按需灵活选用。
具体实现:
1.设想一个经典的dubbo-go示例就是这个最小集合的rpc使用方式,纯api。
2.微服务、治理、配置组装、多协议和各种能力和示例
使用方式
以 原有的注册为例
import (
"github.com/dubbogo/gost/log/logger"
)
import (
"dubbo.apache.org/dubbo-go/v3/common"
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/common/extension"
"dubbo.apache.org/dubbo-go/v3/registry"
"dubbo.apache.org/dubbo-go/v3/remoting"
"dubbo.apache.org/dubbo-go/v3/remoting/polaris"
)
const (
RegistryConnDelay = 3
defaultHeartbeatIntervalSec = 5
)
func init() {
extension.SetRegistry(constant.PolarisKey, newPolarisRegistry)
}
// newPolarisRegistry will create new instance
func newPolarisRegistry(url *common.URL) (registry.Registry, error) {
if err := polaris.InitSDKContext(url); err != nil {
return &polarisRegistry{}, err
}
}
type polarisRegistry struct {
namespace string
url *common.URL
consumer api.ConsumerAPI
provider api.ProviderAPI
lock sync.RWMutex
registryUrls []*common.URL
listenerLock sync.RWMutex
watchers map[string]*PolarisServiceWatcher
}
// Register will register the service @url to its polaris registry center.
func (pr *polarisRegistry) Register(url *common.URL) error {
if getCategory(url) != "providers" {
return nil
}
}
dubbogo框架提供服务注册与发现的扩展,目前已经支持与业界主流注册中心对接。
dubbogo完成了 ETCD、ZooKeeper、Eureka、Consul、Nacos、Polaris 多种服务发现模式,当然也支持 DNS 解析以及 Static IP 直连访问模式,建立起了强大且完备的社区生态,供用户按需灵活选用。
更多服务发现组件参看扩展仓库:dubbogo-contrib/registry-nacos
以 DNS Resolver 为例
import (...
dns "github.com/dubbogo-contrib/resolver-dns"
)
func main() {...
client, err := echo.NewClient("echo", client.WithResolver(dns.NewDNSResolver()))
if err != nil {
log.Fatal(err)}
...}
import (
"github.com/dubbogo/gost/log/logger"
)
import (
"dubbo.apache.org/dubbo-go/v3/common"
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/common/extension"
"dubbo.apache.org/dubbo-go/v3/registry"
"dubbo.apache.org/dubbo-go/v3/remoting"
"dubbo.apache.org/dubbo-go/v3/remoting/polaris"
)
Copy
具体实现:以polaris为例,设计出以polaris为例的dubbogoContrib-polaris扩展,目前打算先实现dubbogoContrib-polaris扩展后,继续其他扩展。
The text was updated successfully, but these errors were encountered: