Thrift 官网地址:https://thrift.apache.org/ 使用版本 0.9.3
Thrift 0.9.3 下载地址:https://thrift.apache.org/download 下载thrift-0.9.3.tar.gz 和 thrift-0.9.3.exe
Thrift allows developers to define datatypes and service interfaces in a single language-neutral file and generate all the necessary code to build RPC clients and servers.
namespace java service.demo
service Hello{
string helloString(1:string para)
i32 helloInt(1:i32 para)
bool helloBoolean(1:bool para)
void helloVoid()
string helloNull()
}
thrift-0.9.3 --gen java Hello.thrift
会在gen-java 目录下面生成Hello.java文件。
建立maven项目,添加libthrift 依赖。