主流PRC框架 thrift 基于flask 微服务架构(其三)
基于flask 微服务架构实现方式
1,采用的是二进制的通信格式
2,app.py 注重于视图的逻辑, client.py 注重于请求服务,server.py注重于处理客户端的请求处理
3,在 '.thrift'文件之中:
1),service PasteFileService{} 定义了服务端接口,属性开头定义了返回的类型!
client 对象调用的就是服务端接口
2),exception NotFound {
1: i32 code
} # 定义了异常
3),struct 定义了结构体类型!
githup 参考代码
https://github.com/shiqilouyang/thrif