Skip to content

It seems that the Cpp2 framework only supports THeaderProtocol? #20

Closed

Description

@huahang

Is it possible to use an AsyncClient to connect to an old TBinaryProtocol server?

Thanks,
Huahang

Activity

  1. djwatson commented on Jun 30, 2014

    @djwatson

    This is correct, cpp2 only supports THeader.

    It's definitely possible to make THeader function in a backwards compatible way though. Something like this should work:

    std::unique_ptr<                                                                                                                                                                                                                                         
      HeaderClientChannel,                                                                                                                                                                                                                                   
      apache::thrift::async::TDelayedDestruction::Destructor> headerChannel(                                                                                                                                                                                 
          HeaderClientChannel::newChannel(asyncsocket));                                                                                                                                                                                                          
      // Always use binary in loadtesting to get apples to apples comparison                                                                                                                                                                                   
      headerChannel->getHeader()->setProtocolId(                                                                                                                                                                                                               
        apache::thrift::protocol::T_BINARY_PROTOCOL);
     headerChannel->getHeader()->setClientType(THRIFT_FRAMED_DEPRECATED); 
     auto client = new Client(std::move(headerChannel)));
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions