Code Monkey home page Code Monkey logo

thriftrpcdemo's Introduction

ThriftRpcDemo

thrift 0.9.3 0.13.0不兼容 c++ java 的thrift文件不一样

0.13.0 Failed to execute goal org.apache.thrift.tools:maven-thrift-plugin:0.1.11:compile (default-cli) on project HelloService: thrift did not exit cleanly. Review output for more information.

重新构建了下,知道了具体原因,才想起还需要配置thrift.exe windows环境 去官网http://thrift.apache.org/download 下载thrift.exe,然后设置环境变量的 path 变量,把thrift.exe 所在目录加上就行 最后打开cmd 验证是否成功:thrift -version 输出版本号信息代表设置成功 Thrift version 0.9.3 然后重启IDEA开发工具,重新构建就成功了  thrift-0.14.0.exe 2021最新版

thrift -version
Thrift version 0.13.0

Thrift server Helloworld demo

a hello world demo: Thrift to Java in maven project

主要是为了观察thrift中service的用法,以及服务端和客户端之间的交互

**todo: **之后可以尝试改成scala的版本

enviroment

thrift: 0.9.3

maven: 3.6.0

jdk: 1.8

Intellij

steps

# bash
git clone ${this respository}
cd ThriftRpcDemo
cd HelloService
mvn clean install  # package jar at local

intellij open project HelloServer

excute Server.main

excute Client.main

Reference

https://blog.csdn.net/u010900754/article/details/80172671

还额外解释了绑定不同Socket的方法 https://blog.csdn.net/houjixin/article/details/42778335

SerializeDemo

主要目的是为了观察thrift中数据结构的定义的用法, 比如 enum struct

里面保存好了thrift编译好之后的java代码,直接ide打开就可以运行Test类了。java和scala是可以直接交互的,所以Java的Test和scala的test我都写了一个小样例

Reference

thrift

thriftrpcdemo's People

Contributors

cfonheart avatar edidada avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.