lzfhust opened a new issue, #1789:
URL: https://github.com/apache/incubator-brpc/issues/1789

   **Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)**
   当前brpc对thrift协议,仅支持单个参数。thrift协议的多参数形式应用广泛,国内一些公司内部也在使用。希望brpc官方也能支持多参数
   
   **Describe the solution you'd like (描述你期望的解决方法)**
   brpc同时支持单参数、多参数
   
   **Describe alternatives you've considered (描述你想到的折衷方案)**
   
   
   **Additional context/screenshots (更多上下文/截图)**
   
   1).  通过 xxx_args来实现多参数:
   1.1. client:
   example::EchoService_Echo_args real_req;
           example::Context context;
           example::EchoRequest req2;
           example::EchoResponse res;
           req2.__set_data("hello");
           real_req.context = std::move(context);
           real_req.request2 = std::move(req2);
           LOG(INFO) << "request data:" << real_req.request2.data;
           stub.CallMethod("Echo", &cntl, &real_req, &res, NULL);
   1.2. server:
          void ProcessThriftFramedRequest(brpc::Controller* cntl,
                                       brpc::ThriftFramedMessage* req,
                                       brpc::ThriftFramedMessage* res,
                                       google::protobuf::Closure* done) 
override {
           // Dispatch calls to different methods
           if (cntl->thrift_method_name() == "Echo") { 
               return Echo(cntl, req->Cast<example::EchoService_Echo_args>(),
                           res->Cast<example::EchoResponse>(), done);
           }
   
   1.3. thrift_protocol.cpp
   在 ReadThriftStruct中,直接读,即: xfer += raw_msg->Read(&iprot);
   在 ThriftClosure::DoRun中,直接写回:xfer += _response.raw_instance()->Write(&oprot);
   
   这样,可以支持多参数。
   
   2).  遇到的问题:
   如何和单参数兼容?
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to