kitex icon indicating copy to clipboard operation
kitex copied to clipboard

grpc multiple services如何注册所有service?

Open slowargo opened this issue 1 year ago • 7 comments

Describe the bug

升级到0.8.0后, 所有的method都注册在CombineService下, 只能使用CombineService的client访问. 客户端如果使用xxxService访问会报错error=unknown service

To Reproduce server upgraded to kitex 0.8.0

Expected behavior 在不改client的前提下, 如何让method除了注册到CombineService, 也注册到它所属的Service名下?

Screenshots

If applicable, add screenshots to help explain your problem.

Kitex version:

Please provide the version of Kitex you are using.

Environment:

The output of go env.

Additional context

Add any other context about the problem here.

slowargo avatar Jan 23 '24 06:01 slowargo

  1. 在 0.8.0 之前应该也是这个行为
  2. 可以等这个月月底左右,我们会发布一个新版本,能直接支持注册多个 service 的操作(像 google grpc 一样),而不再采用 combine-service 这种方式

HeyJavaBean avatar Jan 23 '24 09:01 HeyJavaBean

0.8.0前会忽略service, 所以不会调用失败 0.8.0这个feature算是breaking change

slowargo avatar Jan 23 '24 10:01 slowargo

哦,记错了。grpc 场景一直会检查 service name。服务端也需要用 combine service 注册才行。

HeyJavaBean avatar Jan 24 '24 04:01 HeyJavaBean

欢迎试用 Kitex 单 Server 多 Service (Multiple Service),相对于 Combine Service,这个模式更加推荐,不会生成冗余的代码,客户端也不需要变更。 https://www.cloudwego.io/zh/docs/kitex/tutorials/advanced-feature/multi_service/

GuangmingLuo avatar Mar 11 '24 02:03 GuangmingLuo

您正在尝试在 Server 上同时注册 Combine Service 和其他 Service 。 请注意,Combine Service 只能在 Server 上单独注册。如果您还想注册其他 Service ,则需要将这些 Service 合并到 Combine Service 中,或者在不使用 Combine Service 的情况下单独注册每个 Service 。

所以要先把使用combine service的client都改了, 才能在server改成多 Service?

slowargo avatar Mar 11 '24 03:03 slowargo

您正在尝试在 Server 上同时注册 Combine Service 和其他 Service 。 请注意,Combine Service 只能在 Server 上单独注册。如果您还想注册其他 Service ,则需要将这些 Service 合并到 Combine Service 中,或者在不使用 Combine Service 的情况下单独注册每个 Service 。

所以要先把使用combine service的client都改了, 才能在server改成多 Service?

Multi Service 是把每个 Service 独立注册到 server 里,所以用对应 service 的 client 发起请求就行。

Client 端可以不用变,主要是 server 需要从 combineservice 的用法迁移过来。

felix021 avatar Mar 11 '24 11:03 felix021