You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Silocean (via GitHub)" <gi...@apache.org> on 2023/03/24 02:30:01 UTC

[GitHub] [dubbo] Silocean opened a new issue, #11909: dubbo3客户端服务通过nacos调用下游C++服务失败

Silocean opened a new issue, #11909:
URL: https://github.com/apache/dubbo/issues/11909

   ### 一、目的
   有一个使用brpc的C++下游服务和一个使用dubbo3的java上游服务,希望将C++服务通过nacos HTTP接口注册到nacos注册中心,java服务通过nacos注册中心拿到下游服务实例列表,以此实现跨语言服务调用。
   
   ### 二、实现方法
   1. 在测试机上启动C++服务,监听8000端口;
   2. 使用nacos HTTP接口注册服务(http://localhost:8848/nacos/v1/ns/instance?ip=10.41.133.13&port=8000&weight=1.0&serviceName=brpc-server-provider-test);
   3. 测试机上启动脚本每隔5秒发送一次实例心跳,保证该实例健康;
       服务状态信息如下图所示:
       ![image](https://user-images.githubusercontent.com/6680721/227405059-027d403e-9c9c-4c10-8935-41fef2296f3f.png)
   4. java服务通过dubbo调用该C++服务,使用协议为triple,代码如下:
       ```java
       DubboBootstrap bootstrap = DubboBootstrap.newInstance();
       ReferenceConfig<EchoService> ref = new ReferenceConfig<>();
       ref.setInterface(EchoService.class);
       ref.setProtocol(CommonConstants.TRIPLE);
       ref.setProxy(CommonConstants.NATIVE_STUB);
       ref.setTimeout(3000);
       ConsumerConfig consumerConfig = new ConsumerConfig();
   
       bootstrap.application(new ApplicationConfig("dubbo-grpc-client"))
               .registry(new RegistryConfig("nacos://localhost:8848"))
               .consumer(consumerConfig)
               .reference(ref)
               .start();
   
       EchoService echoService = ref.get();
       EchoRequest request = EchoRequest.newBuilder().setMessage("hello echo").build();
       EchoResponse reply = echoService.echo(request);
       System.out.println("received replay: " + reply.getMessage());
       ```
   5. java客户端调用出错,报错信息如下:
       ![image](https://user-images.githubusercontent.com/6680721/227407150-9318a52e-85a0-4524-baf5-d31daf0484f7.png)
   ### 三、问题
   1. 推测是java客户端调用代码有问题,我理解调用方在调用时需要指定下游的服务名字(brpc-server-provider-test),才能知道调用方要取的是nacos上哪个服务的实例,但是我不清楚应该在哪里设置下游服务名字?
   2. c++服务端注册缺失了metadata?
   


-- 
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.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


Re: [I] dubbo3客户端服务通过nacos调用下游C++服务失败 [dubbo]

Posted by "blessyyyu (via GitHub)" <gi...@apache.org>.
blessyyyu commented on issue #11909:
URL: https://github.com/apache/dubbo/issues/11909#issuecomment-1900237683

   大佬,能否将您这次尝试的代码开源呢?有相同的想法来实现跨语言服务调用


-- 
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] Silocean commented on issue #11909: dubbo3客户端服务通过nacos调用下游C++服务失败

Posted by "Silocean (via GitHub)" <gi...@apache.org>.
Silocean commented on issue #11909:
URL: https://github.com/apache/dubbo/issues/11909#issuecomment-1482528976

   已解决:
   1. metadata中需要加上使用的协议
       ```json
       {
   	"protocol": "tri"
       }
       ```
   2. 服务注册的名字要按照以下固定格式来
       ```
       providers:${rpc接口全限定名}:${version}:${group}
       ```


-- 
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] Silocean closed issue #11909: dubbo3客户端服务通过nacos调用下游C++服务失败

Posted by "Silocean (via GitHub)" <gi...@apache.org>.
Silocean closed issue #11909: dubbo3客户端服务通过nacos调用下游C++服务失败
URL: https://github.com/apache/dubbo/issues/11909


-- 
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