-
Notifications
You must be signed in to change notification settings - Fork 4.1k
support thrift rpc with multipule arguments #495
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
Conversation
| xfer += oprot.writeFieldBegin("request", ::apache::thrift::protocol::T_STRUCT, | ||
| THRIFT_REQUEST_FID); | ||
| // xfer += oprot.writeFieldBegin("request", ::apache::thrift::protocol::T_STRUCT, | ||
| // THRIFT_REQUEST_FID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个行为应该作为controller的一个参数,参数不同而行为不同,而不是直接注释掉,毕竟很多情况下还是只有一个request,要传递xxx_args是有些麻烦的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉按照官方的thrift_gen的版本,xx_args是标准的实现,单参数是『恰好』可以work而已
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确实是这样。不过这里主要是从使用体验考虑,一个参数的情况还是很多的,使用xxx_args未免很繁琐。我也比较倾向于只用一个参数。这个行为不一定要用户指定,由于CallMethod是基于模版的,所以这儿可以使用一个特殊的模板类来判定request类型名是不是形如"Service_Method_args",有误判可能性,但概率很低(相信正常心智的程序员都不会把类命名为Service_Method_args这种形式吧)。这个判定可以只对每个类型只做一次,而不是每次CallMethod前都做。
| void ThriftStub::CallMethod(const char* method_name, | ||
| Controller* cntl, | ||
| const REQUEST* raw_request, | ||
| ::google::protobuf::Closure* done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些代码不需要新启函数,只需要针对raw_response为空的情况特殊处理就行了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个还有下文吗?能支持thrift多参数的情况嘛
|
This issue has been automatically marked as stale because it's inactive for a long time. It will be closed if no further activity occurs, reopen if you have further ideas. Thank you for your contributions! 由于很久没有活跃,此Issue已被自动标记为过期。之后几天仍无变化的话将会被关闭,若你有新想法则可重新打开。感谢你的贡献! |
|
能支持了吗 |
放开Thrift的多参数支持