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

dubbo TagRouter does not work with dubbo:parameter #3875

Closed
2 tasks done
sanjy523892105 opened this issue Apr 15, 2019 · 2 comments · Fixed by #3883
Closed
2 tasks done

dubbo TagRouter does not work with dubbo:parameter #3875

sanjy523892105 opened this issue Apr 15, 2019 · 2 comments · Fixed by #3883
Assignees
Labels
type/bug Bugs to being fixed
Milestone

Comments

@sanjy523892105
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.1
  • Operating System version: win10
  • Java version: jdk1.8.0_101

Steps to reproduce this issue

  1. 使用 dubbo-demo-xml 项目,或者其他测试项目
  2. 启动两个provider示例,一个在 <dubbo:service/> 中加上tag="groupA" 我们叫他 p1,另一个不加tag 我们叫他 p2.
  3. <dubbo:reference>标签中添加<dubbo:parameter key="dubbo.tag" value="groupA"/> 之后将consumer 示例启动

  1. use dubbo-demo-xml, or other demo .
  2. prepare two providers, one set tag="groupA" at <dubbo:service/> called p1 , another with no tag called p2. start them.
  3. start a consumer instance ,after set <dubbo:parameter key="dubbo.tag" value="groupA"/> inside of <dubbo:reference>.

Expected Result

因为拥有相同的tag声明,consumer本应该会调用到p1示例.
consumer would connect p1 because of the same tag definition

Actual Result

但consumer依然可能连接到p2示例.
consumer also connects p2.


如果把 步骤3 的标签改为在调用代码中使用RpcContext.getContext().setAttachment("dubbo.tag","groupA"),是可以正常工作的。请问这两种方式有什么区别呢?

通过分析源码发现 在 RegistryDiscovery 中将consumer 端的parameter 整合到providerUrl 中。 请问为什么需要这步操作?

@chickenlj
Copy link
Contributor

I test and both these two ways can work:
RpcContext.getContext().setAttachment("dubbo.tag","groupA") or <dubbo:parameter key="dubbo.tag" value="groupA"/>

@chickenlj chickenlj added the type/bug Bugs to being fixed label Apr 16, 2019
@chickenlj chickenlj added this to the 2.7.2 milestone Apr 16, 2019
@chickenlj chickenlj self-assigned this Apr 16, 2019
@chickenlj
Copy link
Contributor

Sorry <dubbo:parameter key="dubbo.tag" value="groupA"/> does have some problem, I just ran the wrong sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bugs to being fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants