RPC服务框架-dubbox

来源:互联网 发布:机器人聊天软件 编辑:程序博客网 时间:2024/06/03 19:59

近期公司需用用到很多RPC调用,今天终于能有时间看了一下RPC框架.浏览了谷歌的grpc/FaceBook的Thrift/阿里的dubbo/dubbox/新浪的motan.最终选用dubbox框架.
对比一下这五个框架,grpc和Thrift都是跨语言的,考虑到跨语言使用的可能性不太大,就把这两个框架放弃了,而且grpc有好多问题,现在还不太成熟,而且不兼容spring,这就很难受了.dubbo现在已经停止维护了,放弃.motan不支持redis,项目上很有可能会使用到redis的,在把他淘汰.dobbox是比较好的选择了
如果想用zookeeper来管理服务的话,首先还需要下载zookeeper;zookeeper的配置还是比较简单的,在conf文件夹里新建文件zoo.cfg,内容:


The number of milliseconds of each tick 心跳间隔 毫秒每次

tickTime=2000

The number of ticks that the initial

synchronization phase can take

initLimit=10

The number of ticks that can pass between

sending a request and getting anacknowledgement

syncLimit=5

the directory where the snapshot isstored. //镜像数据位置

dataDir=F:\soft\zookeeper-3.3.6\zookeeper-3.3.6\data

日志位置

dataLogDir=F:\soft\zookeeper-3.3.6\zookeeper-3.3.6\logs

the port at which the clients willconnect 客户端连接的端口

clientPort=2181


其中,dataDir和dataLogDir的路径要根据自己的真实路径写。

使用dubbox框架,服务的提供者和使用者,都需要放入tomcat中(即使提供者或者使用者不需要在浏览器被访问,也要放在服务器中)。然后使用者需要依赖提供者的服务接口,如果返回值是封装的实体类,那么实体类也要被依赖。
集成spring之后,dubbo服务的发布和调用,还是比较简单的。
发布配置:

阅读全文
0 0
原创粉丝点击