Skip to content

Commit

Permalink
optimize: gRPC serialization default to Protobuf (#6991)
Browse files Browse the repository at this point in the history
  • Loading branch information
funky-eyes authored Nov 10, 2024
1 parent 78a0708 commit 835ef47
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6938](https://github.com/apache/incubator-seata/pull/6938)] Update online chat information in README.md
- [[#6950](https://github.com/apache/incubator-seata/pull/6950)] Remove JVM parameter app.id
- [[#6959](https://github.com/apache/incubator-seata/pull/6959)] update the naming and description for the `seata-http-jakarta` module
- [[#6991](https://github.com/apache/incubator-seata/pull/6991)] gRPC serialization default to Protobuf


### refactor:
Expand Down
1 change: 1 addition & 0 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
- [[#6938](https://github.com/apache/incubator-seata/pull/6938)] 更新 README.md 中的社区联系信息
- [[#6950](https://github.com/apache/incubator-seata/pull/6950)] 移除JVM参数app.id
- [[#6959](https://github.com/apache/incubator-seata/pull/6959)] 修正 `seata-http-jakarta`的模块命名和描述
- [[#6991](https://github.com/apache/incubator-seata/pull/6991)] gRPC协议序列化默认值为protobuf

### refactor:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public void onDataRead(ChannelHandlerContext ctx, Http2DataFrame msg) throws Exc
bodyBytes = compressor.decompress(bodyBytes);
}
String codecValue = headMap.get(GrpcHeaderEnum.CODEC_TYPE.header);
int codec = Integer.parseInt(codecValue);
int codec = StringUtils.isBlank(codecValue) ? SerializerType.PROTOBUF.getCode()
: Integer.parseInt(codecValue);
SerializerType serializerType = SerializerType.getByCode(codec);
rpcMsg.setCodec(serializerType.getCode());
Serializer serializer = SerializerServiceLoader.load(serializerType);
Expand Down

0 comments on commit 835ef47

Please sign in to comment.