dnjat opened a new issue, #2860:
URL: https://github.com/apache/dubbo-go/issues/2860
### Environment
<!--
- Server: Dubbo-go, v3.3.0
- Client: Dubbo-go, v3.3.0
- Protocol: Dubbo
- Registry: Nacos, v2.3.2
-->
- Server:
- Client:
- Protocol:
- Registry:
### Issue description
<!-- Here is a brief description about the issue. -->
### Logs
<details><summary>Click me to check logs</summary>
```
Copy logs to here.
```
</details>
服务端注册
func RegisterDubboRpcServer(greeter *GreeterService) {
ins, err := dubbo.NewInstance(
dubbo.WithName("go-blog.dubbo.rgpc"),
dubbo.WithRegistry(
registry.WithNacos(),
registry.WithAddress("192.168.14.137:8848"),
registry.WithNamespace("dubbo-go"),
registry.WithUsername("nacos"),
registry.WithPassword("nacos"),
),
//dubbo.WithProtocol(
// protocol.WithDubbo(),
// protocol.WithPort(20001)),
)
if err != nil {
panic(err)
}
srv, err := ins.NewServer(
server.WithServerProtocol(
protocol.WithDubbo(),
protocol.WithPort(20001),
),
)
if err != nil {
panic(err)
}
if err := greet.RegisterGreeterHandler(srv, greeter); err != nil {
panic(err)
}
// 用来测试的,换一种注册方式
//if err := srv.Register(greeter, nil,
server.WithInterface("GreeterService"),
server.WithSerialization(constant.Hessian2Serialization)); err != nil {
// panic(err)
//}
if err := srv.Serve(); err != nil {
logger.Error(err)
}
}
客户端注册
func RegisterDubboRpcClient() {
ins, err := dubbo.NewInstance(
dubbo.WithName("go-wxmc.dubbo.rgpc"),
dubbo.WithRegistry(
registry.WithNacos(),
registry.WithAddress("192.168.14.137:8848"),
registry.WithNamespace("dubbo-go"),
registry.WithUsername("nacos"),
registry.WithPassword("nacos"),
),
)
if err != nil {
panic(err)
}
// configure the params that only client layer cares
cli, err := ins.NewClient(
client.WithClientProtocolDubbo(),
client.WithClientSerialization(constant.Hessian2Serialization),
)
if err != nil {
panic(err)
}
svc, err := v1.NewGreeter(cli)
if err != nil {
panic(err)
}
//这句调用后会出现无限等待
resp, err := svc.SayHello(context.Background(), &v1.HelloRequest{Name:
"dubbo rpc"})
if err != nil {
//fmt.Printf("098FB268", err)
panic(err)
}
fmt.Printf("C272AB2E", resp)
}
客户端调用后,进入无限等待
--
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]