You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/03 03:18:33 UTC

[GitHub] [dubbo] plusmancn opened a new issue #8666: [3.0] The problem collection of Triple with ApplicationDiscovery

plusmancn opened a new issue #8666:
URL: https://github.com/apache/dubbo/issues/8666


   We have found these issues to be related to Triple with ApplicationDiscovery:
   - [ ] https://github.com/apache/dubbo/issues/8599
   - [ ] https://github.com/apache/dubbo/issues/8462
   
   What we should do  for further promotion: 
   - [ ] Complete the docs: [Triple协议迁移指南](https://dubbo.apache.org/zh/docs/migration/migration-triple/) as soon as possible
   - [ ] The logic of preferredProtocol was not user-friendly, we maybe should optimize it.
   - [ ] Optimize the `dubbo-spring-boot-starter`, especially the autoconfigure.
   - [ ] Give a demo about SpringBoot integrate with Dubbo 3.0 which cover ApplicationDiscovery, Triple Protocol
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] guohao commented on issue #8666: [3.0] The problem collection of Triple with ApplicationDiscovery

Posted by GitBox <gi...@apache.org>.
guohao commented on issue #8666:
URL: https://github.com/apache/dubbo/issues/8666#issuecomment-914037479


   Doc of migration to triple is constructing in https://github.com/apache/dubbo-website/pull/941/files


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] guohao commented on issue #8666: [3.0] The problem collection of Triple with ApplicationDiscovery

Posted by GitBox <gi...@apache.org>.
guohao commented on issue #8666:
URL: https://github.com/apache/dubbo/issues/8666#issuecomment-912234570


   Agreed on triple doc construction, I will start this task ASAP


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] CrazyHZM closed issue #8666: [3.0] The problem collection of Triple with ApplicationDiscovery

Posted by GitBox <gi...@apache.org>.
CrazyHZM closed issue #8666:
URL: https://github.com/apache/dubbo/issues/8666


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] EarthChen commented on issue #8666: [3.0] The problem collection of Triple with ApplicationDiscovery

Posted by GitBox <gi...@apache.org>.
EarthChen commented on issue #8666:
URL: https://github.com/apache/dubbo/issues/8666#issuecomment-912263958


   I will also assist in these tasks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] guohao edited a comment on issue #8666: [3.0] The problem collection of Triple with ApplicationDiscovery

Posted by GitBox <gi...@apache.org>.
guohao edited a comment on issue #8666:
URL: https://github.com/apache/dubbo/issues/8666#issuecomment-914037479


   Doc of migration to triple is constructing in https://github.com/apache/dubbo-website/pull/941


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] plusmancn removed a comment on issue #8666: [3.0] The problem collection of Triple with ApplicationDiscovery

Posted by GitBox <gi...@apache.org>.
plusmancn removed a comment on issue #8666:
URL: https://github.com/apache/dubbo/issues/8666#issuecomment-913655259


   ## The logic of preferredProtocol was not user-friendly, we maybe should optimize it.
   
   ### What's the problem?
   When we only use the `triple` protocol in dubbo with setting provider's register-mode as `instance`, the consumer can't find the service.
   
   
   The source is in `org.apache.dubbo.config.metadata.ServiceInstanceHostPortCustomizer`, let's have a look:
   
   
   ```java
   @Override
   public void customize(ServiceInstance serviceInstance) {
       String host = null;
       int port = -1;
       // ......
       Set<URL> urls = writableMetadataService.getExportedServiceURLs();
       if (CollectionUtils.isNotEmpty(urls)) {
           ApplicationModel applicationModel = serviceInstance.getApplicationModel();
           String preferredProtocol = applicationModel.getCurrentConfig().getProtocol();
           //  The default value of preferredProtocol is dubbo.
           if (preferredProtocol != null) {
               for (URL exportedURL : urls) {
                   // The protocol of exportedURL is tri
                   // because of tri != dubbo, the host and port will not be assigned values.
                   if (preferredProtocol.equals(exportedURL.getProtocol())) {
                       host = exportedURL.getHost();
                       port = exportedURL.getPort();
                       break;
                   }
               }
           } else {
               URL url = urls.iterator().next();
               host = url.getHost();
               port = url.getPort();
           }
           // If not the port of instace > 0, the application instance will not be registered to RegistryCenter(like Nacos, Zookeeper).
           // As a result, the consumer can't find the avaliabe providers when our settging is registry-mode=instance
           if (serviceInstance instanceof DefaultServiceInstance) {
               DefaultServiceInstance instance = (DefaultServiceInstance) serviceInstance;
               instance.setHost(host);
               instance.setPort(port);
           }
       }
   }
   ```
   
   
   For the moment, if you want both consumer and provider to force using `Application Discovery` in tri protocol, just change one line config of provider as follows:
   
   
   ```yaml
   dubbo:
     application:
       metadata-type: remote
       register-mode: instance
       protocol: tri  <==== HERE, set preferredProtocol as tri
   ```
   
   
   
   
   ### The possible solution
   change the default `application-protocol` as `TRIPLE` in the future
   > Why not now? Because most users are still trying to migrate from 2.0 to 3.0
   
   ```java
   // => org.apache.dubbo.config.ApplicationConfig#checkDefault
   protected void checkDefault() {
       super.checkDefault();
       if (protocol == null) {
           protocol = DUBBO;   // <======= HERE
       }
       // ......
   }
   ```
   In `ServiceInstanceHostPortCustomizer`, If the default protocol not exists, just try to get the first protocol and log an error log.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] plusmancn commented on issue #8666: [3.0] The problem collection of Triple with ApplicationDiscovery

Posted by GitBox <gi...@apache.org>.
plusmancn commented on issue #8666:
URL: https://github.com/apache/dubbo/issues/8666#issuecomment-913655259


   ## The logic of preferredProtocol was not user-friendly, we maybe should optimize it.
   
   ### What's the problem?
   When we only use the `triple` protocol in dubbo with setting provider's register-mode as `instance`, the consumer can't find the service.
   
   
   The source is in `org.apache.dubbo.config.metadata.ServiceInstanceHostPortCustomizer`, let's have a look:
   
   
   ```java
   @Override
   public void customize(ServiceInstance serviceInstance) {
       String host = null;
       int port = -1;
       // ......
       Set<URL> urls = writableMetadataService.getExportedServiceURLs();
       if (CollectionUtils.isNotEmpty(urls)) {
           ApplicationModel applicationModel = serviceInstance.getApplicationModel();
           String preferredProtocol = applicationModel.getCurrentConfig().getProtocol();
           //  The default value of preferredProtocol is dubbo.
           if (preferredProtocol != null) {
               for (URL exportedURL : urls) {
                   // The protocol of exportedURL is tri
                   // because of tri != dubbo, the host and port will not be assigned values.
                   if (preferredProtocol.equals(exportedURL.getProtocol())) {
                       host = exportedURL.getHost();
                       port = exportedURL.getPort();
                       break;
                   }
               }
           } else {
               URL url = urls.iterator().next();
               host = url.getHost();
               port = url.getPort();
           }
           // If not the port of instace > 0, the application instance will not be registered to RegistryCenter(like Nacos, Zookeeper).
           // As a result, the consumer can't find the avaliabe providers when our settging is registry-mode=instance
           if (serviceInstance instanceof DefaultServiceInstance) {
               DefaultServiceInstance instance = (DefaultServiceInstance) serviceInstance;
               instance.setHost(host);
               instance.setPort(port);
           }
       }
   }
   ```
   
   
   For the moment, if you want both consumer and provider to force using `Application Discovery` in tri protocol, just change one line config of provider as follows:
   
   
   ```yaml
   dubbo:
     application:
       metadata-type: remote
       register-mode: instance
       protocol: tri  <==== HERE, set preferredProtocol as tri
   ```
   
   
   
   
   ### The possible solution
   change the default `application-protocol` as `TRIPLE` in the future
   > Why not now? Because most users are still trying to migrate from 2.0 to 3.0
   
   ```java
   // => org.apache.dubbo.config.ApplicationConfig#checkDefault
   protected void checkDefault() {
       super.checkDefault();
       if (protocol == null) {
           protocol = DUBBO;   // <======= HERE
       }
       // ......
   }
   ```
   In `ServiceInstanceHostPortCustomizer`, If the default protocol not exists, just try to get the first protocol and log an error log.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org