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.剩下的和其他的配置没有区别,具体的代码官网有详细的,再此不啰嗦了。
本文详细介绍如何在Dubbo中集成Thrift协议,包括编写Thrift IDL文件、实现服务端接口、正确配置Dubbo以识别Thrift服务等步骤。
4627

被折叠的 条评论
为什么被折叠?



