[Disscuss]dubbo对protobuf 序列化严格只支持protobuf生成的类型
- Dominant language
- Java
- Stars
- 41.6k
- Forks
- 26.4k
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 4
Description
以gRPC为例,只支持pb生成的类型,不支持pb里定义的原生类型,如int32/string 等。
比如下面的gRPC配置是不合法的,不能返回int32,要定义包装一层:
```
// The test service definition.
service Test {
// Sends a greeting
rpc SayHello (HelloReply) returns int32;
}
```
---
目前dubbo里pb支持了原始类型,但 map只支持 `` 。
1. 这样子对于用户来说是很困惑的,为啥 map只能是`` 。
2. 目前没有太好的办法解决所有的类型问题,可能到最终也没有办法解决
---
所以,建议dubbo里去掉原始类型的支持,和gRPC类似,只支持pb生成的类型。
1. 本质上rpc函数的参数和返回值,都是一个pb定义的对象,它是有tag的,它里面是可以增加/废弃字段的。如果只有原始类型的话,那么就没有tag了
2. gRPC本身不支持pb里的原始类型,说明gRPC本身知道里面的坑
3. 用pb本身的方式来包装一下,对性能来说,没有损失
Contributor guide
Research direction
Start by tracing Dubbo's protobuf serialization support and identify where primitive values and map types are handled. Compare the current behavior with gRPC's restriction to protobuf-generated message types, then determine the compatibility impact before deciding whether removing primitive support is feasible. Done means the supported parameter, return, and map types are clearly defined and consistently enforced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100