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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to