Giter VIP home page Giter VIP logo

bbspring-thrift-starter's Introduction

整合Apache Thrift到Spring Cloud

服务端

  • 参照RestController跟RequestMapping添加ThriftController注解

    @ThriftController(value = "/thriftcaclcu")
    public class CalculatorController implements TCalculatorService.Iface {    
    		@Override    
    		public int calculate(int num1, int num2, TOperation op) throws TException{ 
    		// your code
    		}
    }
    
  • 添加spring cloud sleuth支持

客户端

  • 参照FeignClient添加ThriftClient注解

        
    @ThriftClient(serviceId = "bbthriftserver", path = "/thriftcaclcu")
    TCalculatorService.Client tcalculatorClient;
    
  • 相关配置

    bbthriftserver:
    		endpoint:  #cloud情况下默认为空,非空就是直连
    		connectTimeout: 1000
    		readTimeout: 10000    
    thrift.client.max.threads: 10  #默认即10
    

已有功能

  • 扩展TTransport支持从注册中心获取服务列表并根据既定策略进行负载,详见TLoadBalancerClient类,利用Netflix
  • 服务端添加Metrics支持,统计各服务响应时间及各方法调用次数
  • 封装TServiceClient支持超时熔断保护利用Hystrix

待做功能

  • 扩展TProtocol支持调用信息采集操作
  • 扩展TProcessor支持信息采集操作及安全监测
  • 服务请求链路上下文调用链路传递

工程简述

  • thrift-definition thrift定义文件所在工程
  • thrift-server是一个关于如何使用的例子,需要在本地启动一个consul agent,里面的常规restcontroller中模拟一个向thriftcontroller请求的例子

bbspring-thrift-starter's People

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.