dubbo/dubbox(二)Thrift协议实现

来源:互联网 发布:淘宝的91论坛共享号 编辑:程序博客网 时间:2024/06/04 08:55

dubbo采用Thrift协议其实官网上已经说的很明白了。具体配置文件我在官网上没有发现。特此写下该文章,备忘。

1.写Thrift 的IDL,生成JAVA文件。copy到服务端和客户端,客户端只拷贝接口文件就OK。

2.服务端对接口实现。

3.书写配置文件,我在网上搜索了好久都没有找到配置文件。

   其中自己配置Iface接口的时候,总是报错,找不到该类。原因是接口在类的内部要使用,com.sfbest.thrift.demo.HelloWorldService$Iface而并非com.sfbest.thrift.demo.HelloWorldService.Iface。

<dubbo:application name="dubboTest-client" /><dubbo:registry address="zookeeper://hadoop3:2181"></dubbo:registry><dubbo:protocol name="thrift" port="3030" /><dubbo:reference id="userService" interface="com.service.UserService" check="false" async="false" protocol="thrift"></dubbo:reference><dubbo:reference id="helloWordService" interface="<span style="color:#ff6666;"><strong>com.sfbest.thrift.demo.HelloWorldService$Iface</strong></span>" check="false" async="false"></dubbo:reference>
4.剩下的和其他的配置没有区别,具体的代码官网有详细的,再此不啰嗦了。


1 0