gpt4 book ai didi

python - 将 Python Thrift 客户端与 Go gRPC 服务器接口(interface)

转载 作者:行者123 更新时间:2023-12-01 22:24:47 24 4
gpt4 key购买 nike

可以这样开始吗?它在 gRPC FAQ 中说:

Can I use gRPC with my favorite data format (JSON, Protobuf, Thrift, XML) ?

Yes. gRPC is designed to be extensible to support multiple content types. The initial release contains support for Protobuf and with external support for other content types such as FlatBuffers and Thrift, at varying levels of maturity.



但是我还没有找到任何有关此的文档?具体来说,我想从 Python 客户端(Thrift)与我用 Go 编写的 gRPC 服务器交谈。

最佳答案

不,您不能让 Python Thrift 客户端与 Go gRPC 服务器通信。

有两个相似但相关的东西混合在一起:RPC 协议(protocol)和消息模式/IDL/格式。

Thrift 和 gRPC 之间的 RPC 协议(protocol)是不同的。它们不可互操作。这就是你所要求的,所以这就是为什么答案是否定的。

gRPC FAQ 说可以使用 protobuf 以外的东西作为消息模式/IDL/格式。所以这将允许 Python gRPC 客户端与 Go gRPC 服务器通信,但使用 Thrift 消息。 grpc-ecosystem/grift包含一些允许从 Thrift IDL 文件生成 gRPC stub 的未维护代码,但它不支持 Python。

关于python - 将 Python Thrift 客户端与 Go gRPC 服务器接口(interface),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60734197/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com