2.环境安装

  下载thrift编译器

  下载地址:http://www.apache.org/dyn/closer.cgi?path=/thrift/0.12.0/thrift-0.12.0.exe

  点击如图进行下载

  thrift快速入门

   下载后去掉版本号:

  thrift快速入门

   设置环境变量:

  thrift快速入门

   检查是否安装成功:

  thrift快速入门

   环境完美!

3.demo演示

  编写.thrift文件

namespace java com.wfd360.demo07.thrift
namespace py py.thrift.generated

typedef i16 short
typedef i32 int
typedef i64 long
typedef bool boolean
typedef string String

struct Person {
    1: optional String username,
    2: optional int age,
    3: optional boolean married
}

exception DataException {
    1: optional String message,
    2: optional String callStack,
    3: optional String date
}

service PersonService {
    Person getPersonByUsername(1: required String username) throws (1: DataException dataException),

    void savePerson(1: required Person person) throws (1: DataException dataException)
}
View Code

相关文章:

  • 2021-12-07
  • 2022-01-07
  • 2021-11-15
  • 2021-06-21
  • 2021-12-13
  • 2018-09-16
猜你喜欢
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
  • 2022-03-04
  • 2022-12-23
  • 2021-10-18
相关资源
相似解决方案