You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "haiyang1985 (GitHub)" <gi...@apache.org> on 2018/09/29 06:01:21 UTC

[GitHub] [incubator-dubbo] haiyang1985 opened issue #2583: ApplicationModel serviceName is not unique

- [ ] I have searched the [issues](https://github.com/apache/incubator-dubbo/issues) of this repository and believe that this is not a duplicate.
- [ ] I have checked the [FAQ](https://github.com/apache/incubator-dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate.

### Environment

* Dubbo version: all
* Operating System version: all
* Java version: all

### Steps to reproduce this issue
1. create two ReferenceConfig for same service with different configuration.
<dubbo:reference id="demoService" interface="com.alibaba.dubbo.DemoService">
</dubbo:reference>
<dubbo:reference id="demoServiceAsync" interface="com.alibaba.dubbo.DemoService" async="true">
</dubbo:reference>
2. startup the consumer application.
3. get the ConsumerModel from ApplicationModel.


Pls. provide [GitHub address] to reproduce this issue.

### Expected Result
ApplicationModel.allConsumerModels() should returns two ConsumerModel.

### Actual Result
ApplicationModel.allConsumerModels() only returns the first ConsumerModel.

If there is an exception, please attach the exception trace:

With future investigation, ReferenceConfig cannot put the second ConsumerModel as they are in same serviceName.

Also, this is the same issue for provider with below configuration.
<bean id="demoService" class="com.alibaba.dubbo.DemoServiceImpl"/>
<dubbo:service interface="com.alibaba.dubbo.DemoService" ref="demoService">
</dubbo:service>
<bean id="demoService2" class="com.alibaba.dubbo.DemoServiceImpl2"/>
<dubbo:service interface="com.alibaba.dubbo.DemoService" ref="demoService2">
</dubbo:service>

Here is my PR: https://github.com/apache/incubator-dubbo/pull/2582

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2583 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] Jeff-Lv commented on issue #2583: ApplicationModel serviceName is not unique

Posted by "Jeff-Lv (GitHub)" <gi...@apache.org>.
I don't think this is a problem or fixing bug. Here are two reasions.

1) Pratically,  the same service is not recommended to create twice on the consumer side. If async and sync are both needed,  we can do it in mehod level to config, or a util method to switch between aync and sync.

2) most importantly, please check the two classes (URL and StringUtils), there is a method named getServiceKey, which is used commonly in Dubbo. A service can be unique under three properties whare are serviceInterface, Group, Version. So,  there is no property Ref to constraint service's unique. 

For example, a group rule or route rule is defined in ZK, which service is it applied to? I think, serviceKey (name, group, version) is the condition. So as the online/offline rules.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2583 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] Jeff-Lv commented on issue #2583: ApplicationModel serviceName is not unique

Posted by "Jeff-Lv (GitHub)" <gi...@apache.org>.
I don't think this is a problem or fixing bug. Here are two reasions.

1) Pratically,  the same service is not recommended to create twice on the consumer side. If async and sync are both needed,  we can do it in mehod level to config, or a util method to switch between aync and sync.

2) most importantly, please check the two classes (URL and StringUtils), there is a method named getServiceKey, which is used commonly in Dubbo. A service can be unique under three properties whare are serviceInterface, Group, Version. So,  there is no property Ref to constraint service's unique. 

For example, a group rule or route rule is defined in ZK, which service is it applied to? I think, serviceKey (name, group, version) is the condition.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2583 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] beiwei30 closed issue #2583: ApplicationModel serviceName is not unique

Posted by "beiwei30 (GitHub)" <gi...@apache.org>.
[ issue closed by beiwei30 ]

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2583 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] beiwei30 commented on issue #2583: ApplicationModel serviceName is not unique

Posted by "beiwei30 (GitHub)" <gi...@apache.org>.
@haiyang1985 I drop a comment in https://github.com/apache/incubator-dubbo/pull/2582#pullrequestreview-162318577, pls. take a look.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2583 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] haiyang1985 commented on issue #2583: ApplicationModel serviceName is not unique

Posted by "haiyang1985 (GitHub)" <gi...@apache.org>.
Yes. 
The flexibility of refer a service with different proxy is good(As above, one proxy in sync, another in async). But, it's terrible that we are not able to get the proxy we have created. 
For that, we are able to cache the proxy by extend the ProxyFactory. But, the issue is that the wrapper executed without order, which result in different proxy returned. 
Hopefully, the constrains be removed from the ApplicationModel cache.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2583 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] kimmking commented on issue #2583: ApplicationModel serviceName is not unique

Posted by "kimmking (GitHub)" <gi...@apache.org>.
It is dependent on how do you defind a Service:
- a backend service is a Service
- or a proxy service is a Service

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2583 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] Jeff-Lv commented on issue #2583: ApplicationModel serviceName is not unique

Posted by "Jeff-Lv (GitHub)" <gi...@apache.org>.
I don't think this is a problem or fixing bug. Here are two reasions.

1) Pratically,  the same service is not recommended to create twice on the consumer side. If async and sync are both needed,  we can do it in mehod level to config, or a util method to switch between aync and sync.

2) most importantly, please check the two classes (URL and StringUtils), there is a method named getServiceKey, which is used commonly in Dubbo. A service can be unique under three properties whare are serviceInterface, Group, Version. So,  there is no property Ref to constraint service's unique. 

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2583 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] beiwei30 commented on issue #2583: ApplicationModel serviceName is not unique

Posted by "beiwei30 (GitHub)" <gi...@apache.org>.
@Jeff-Lv I agree with your opinion. For this particular problem, let's consider it as a limitation. User cannot configure two references with the different behavior. We will provide alternative way to user to change the behavior either via API, utilities or dynamic config.

Let's roll back the relevant change in https://github.com/apache/incubator-dubbo/pull/2646.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2583 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org