Skip to content
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

add default.version support #91

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

llggttd
Copy link

@llggttd llggttd commented Nov 6, 2018

dubbo 服务指定版本有两种方式

<!-- 统一指定 -->
<dubbo:provider loadbalance="leastactive" delay="-1" version="1.0.0"/>
<dubbo:service interface="top.crazyman.dubbo.service.CommonService" ref="commonService"/>
<!-- 单独指定 -->
<dubbo:provider loadbalance="leastactive" delay="-1"/>
<dubbo:service interface="top.crazyman.dubbo.service.CommonService" ref="commonService"  version="1.0.0"/>

在统一指定版本时,向zookeeper中注册服务生成的url参数中没有version, 取而代之的是default.version, 如:dubbo://10.0.75.1:20880/top.crazyman.dubbo.service.CommonService?anyhost=true&application=dubbo-learn-provider&default.delay=-1&default.loadbalance=leastactive&default.version=1.0.0&delay=-1&dubbo=2.6.3&environment=product&generic=false&interface=top.crazyman.dubbo.service.CommonService&methods=getCurrentDate&pid=15440&side=provider&timestamp=1541501405883&uptime=1541501405931"

在index.js文件resolveService方法中,在匹配对应服务提供者时,是直接通过queryObj.version来判断的,这里会造成匹配不到正确的服务提供者。index.js

for (let i = 0; i < size; i++) {
    const provider = url.parse(decodeURIComponent(children[i]));
    const queryObj = qs.parse(provider.query);
    if (
        queryObj.version === depVal.version &&
        queryObj.group === depVal.group &&
        provider.protocol === "dubbo:"
    ) {
        providers.push(provider);
    }
}

@omnip620
Copy link
Owner

关于excute的问题 我们在想 是否需要改变调整一下动态添加方法的方式 彻底解决方法可能会冲突的问题 初步思路是返回一个新的对象 而不是在原来的类上暴力添加

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants