Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

计数器用grpc运行 #1015

Open
chenzhanpeng opened this issue Jul 23, 2023 · 1 comment
Open

计数器用grpc运行 #1015

chenzhanpeng opened this issue Jul 23, 2023 · 1 comment

Comments

@chenzhanpeng
Copy link

chenzhanpeng commented Jul 23, 2023

计数器这个demo 我通过spi配置成grpc,就能用了,有一点不明白的是,例子中反序列化数据 counterOperation = SerializerManager.getSerializer(SerializerManager.Hessian2).deserialize(
data.array(), CounterOperation.class.getName());,这外不是默认协议用的序列化方式吗,为啥grpc也能用

@fengjiachun
Copy link
Contributor

这只是把 bytes 解析成 CounterOperation,gRPC 用的是 Protobuf,但是在 gRPC 的 Protobuf 中只看到了 bytes,大致是这个样子:

message CounterOperation {
  bytes data = 1;
}

上面的 data 字段使用 Hessian2 序列化成 bytes 的,Protobuf 只看到 bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants