Dubbo 允许配置多协议,在不同服务上支持不同协议或者同一服务上同时支持多种协议

1.不同服务不同协议配置

  不同服务在性能上适用不同协议进行传输,比如大数据用短连接协议,小数据大并发用长连接协议

 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
     xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://code.alibabatech.com/schema/dubbohttp://code.alibabatech.com/schema/dubbo/dubbo.xsd">
     <dubbo:application name="world"  />
     <dubbo:registry id="registry" address="10.20.141.150:9090" username="admin" password="hello1234" />
     <!-- 多协议配置 -->
     <dubbo:protocol name="dubbo" port="20880" />
     <dubbo:protocol name="rmi" port="1099" />
     <!-- 使用dubbo协议暴露服务 -->
     <dubbo:service interface="com.alibaba.hello.api.HelloService" version="1.0.0" ref="helloService" protocol="dubbo" />
     <!-- 使用rmi协议暴露服务 -->
     <dubbo:service interface="com.alibaba.hello.api.DemoService" version="1.0.0" ref="demoService" protocol="rmi" />
 </beans>

2.同一服务上同时支持多种协议

  需要与 http 客户端互操作

 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
     xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://code.alibabatech.com/schema/dubbohttp://code.alibabatech.com/schema/dubbo/dubbo.xsd">
     <dubbo:application name="world"  />
     <dubbo:registry id="registry" address="10.20.141.150:9090" username="admin" password="hello1234" />
     <!-- 多协议配置 -->
     <dubbo:protocol name="dubbo" port="20880" />
     <dubbo:protocol name="hessian" port="8080" />
     <!-- 使用多个协议暴露服务 -->
     <dubbo:service id="helloService" interface="com.alibaba.hello.api.HelloService" version="1.0.0" protocol="dubbo,hessian" />
 </beans>

最新文章

  1. 怎样使用VMware Workstation(虚拟机)
  2. Java中StringBuilder的清空方法比较
  3. jQuery核心之DOM操作的常用方法
  4. mysql存储过程出参入参,sqlserver很熟悉的一件事到mysql,捣鼓了大半天。记录一下提醒自己。勿看
  5. PHP生成 excl、word文件
  6. MySQL auto_increment的坑
  7. oracle学习总结3
  8. [转贴]超级懒汉编写的基于.NET的微信SDK
  9. 排序 O(nlogn)
  10. OC语言-02面向对象的三大特性
  11. 执行npm安装模块的命令 Cannot find module
  12. java线程池分析和应用
  13. Spring框架_代理模式(静态代理,动态代理,cglib代理)
  14. winfrom datagridview中DataGridViewTextBoxColumn的联动处理
  15. IPv6下网络编程socket, TCP和UDP例子,以及兼容IPV4和IPV6的类
  16. .NET条形码
  17. DB2事务日志
  18. Postgresql源码安装
  19. Arcengine 二次开发得到点shapefile的坐标
  20. context.Request方法总结

热门文章

  1. vue 倒计时返回首页
  2. codeforces15E Triangles
  3. opencv产生随机的颜色
  4. 31、LinkedHashSet简介和练习
  5. linux服务-ssh
  6. spring-boot-单元测试参数数
  7. 在linux上安装完oracle数据库后,如何修改ORACLE_HOSTNAME
  8. bzoj 3236: 洛谷 P4396: [AHOI2013]作业 (莫队, 分块)
  9. 【bzoj题解】题解传送门
  10. 数据库-mysql事务