- [ X] I have searched the issues of this repository and believe that this is not a duplicate.
- [ X] I have checked the FAQ of this repository and believe that this is not a duplicate.
Environment
- Dubbo version: 2.7.7
- Operating System version: macOS
- Java version: 1.8
Steps to reproduce this issue
- Two provider service with same interface [GreetingsService] and different service-port and provider-tag[dubbo-tag=grey];--- Provider-A(no tag), Provider-B(with tag),
- Start one Consumer to call the GreetingsService with no tag; --- Consumer-X(no tag),
Expected Result
What do you expected from the above steps?
I think and need the consumer to call the provider with no tag grey;
Actual Result
What actually happens?
The consumer always call the provider with tag grey;
Reason
When dubbo initial the consumer service reference, it will merge the all provider Parameters to the consumer Parameter map; then do the provider select will use the provider's tag to select provider;
TagRouter
@Override
public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
if (CollectionUtils.isEmpty(invokers)) {
return invokers;
}
// since the rule can be changed by config center, we should copy one to use.
final TagRouterRule tagRouterRuleCopy = tagRouterRule;
if (tagRouterRuleCopy == null || !tagRouterRuleCopy.isValid() || !tagRouterRuleCopy.isEnabled()) {
return filterUsingStaticTag(invokers, url, invocation);
}
List<Invoker<T>> result = invokers;
String tag = StringUtils.isEmpty(invocation.getAttachment(TAG_KEY)) ? url.getParameter(TAG_KEY) :
invocation.getAttachment(TAG_KEY);
// if we are requesting for a Provider with a specific tag
if (StringUtils.isNotEmpty(tag)) {
Environment
Steps to reproduce this issue
Expected Result
What do you expected from the above steps?
Actual Result
What actually happens?
Reason
When dubbo initial the consumer service reference, it will merge the all provider Parameters to the consumer Parameter map; then do the provider select will use the provider's tag to select provider;
TagRouter