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

Thrift IDL自动生成的skeleton代码相关修复 #50

Closed
holmes1412 opened this issue Mar 22, 2021 · 1 comment
Closed

Thrift IDL自动生成的skeleton代码相关修复 #50

holmes1412 opened this issue Mar 22, 2021 · 1 comment

Comments

@holmes1412
Copy link
Contributor

holmes1412 commented Mar 22, 2021

各位小伙伴,srpc会根据IDL文件自动生成两份代码:

  • 如果IDL是protobuf,会生成server.pb_skeleton.ccclient.pb_skeleton.cc;
  • 如果IDL是thrift,会生成server.thrift_skeleton.ccclient.thrift_skeleton.cc;

原生成的代码里thrift部分有误,会默认启动SRPCServerSRPCClient,已经改成默认启动ThriftFramed协议的ThriftServerThriftClient了,main()函数如下:

int main()
{
    unsigned short port = 1412;
    ThriftServer server; // 这里已修改为默认启动ThriftFramed协议的server

    ExampleServiceImpl example_impl;
    server.add_service(&example_impl);

    server.start(port);
    wait_group.wait();
    server.stop();
    return 0;
}

SRPC的Thrift Framed server/client可以和原生的其他语言的thrift互通,使用非常方便,欢迎大家尝试~

@holmes1412 holmes1412 changed the title Thrift Framed协议自动生成的skeleton代码相关修复 Thrift IDL自动生成的skeleton代码相关修复 Mar 22, 2021
@Barenboim
Copy link
Contributor

Barenboim commented Mar 22, 2021

这个修改只是影响框架代码的默认协议,不是正确性修改。原来的框架代码产生的是SRPC协议,thrift IDL的service,一般大家很少使用。新框架代码产生的就是Thrift framed binary协议的server与client,可以与所有语言的apache thrift互通。

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