zoukankan      html  css  js  c++  java
  • dubbo服务的group和version

    group

    当一个接口有多种实现时,可以用group区分

    <!-- dubbo group 使用示例 -->
    <bean id="demoA" class="com.xxx.IndexServiceImpl1" />
    <dubbo:service group="feedback" interface="com.xxx.IndexService" ref="demoA" />
    
    <bean id="demoB" class="com.xxx.IndexServiceImpl2" />
    <dubbo:service group="member" interface="com.xxx.IndexService" ref="demoB" />

    此外,dubbo消费者也可以设置为:消费任意一个group的服务。

    <dubbo:reference id="barService" interface="com.foo.BarService" group="*" />

    version

    当一个接口的实现,出现不兼容升级时,可以用版本号过渡,版本号不同的服务相互间不引用

    <!-- 机器A提供1.0.0版本服务 -->
    <dubbo:service interface="com.foo.BarService" version="1.0.0" />
    <!-- 机器B提供2.0.0版本服务 -->
    <dubbo:service interface="com.foo.BarService" version="2.0.0" />
    <!-- 机器C消费1.0.0版本服务 -->
    <dubbo:reference id="barService" interface="com.foo.BarService" version="1.0.0" />
    <!-- 机器D消费2.0.0版本服务 -->
    <dubbo:reference id="barService" interface="com.foo.BarService" version="2.0.0" />

    此外,消费者消费服任意版本的服务时:

    <dubbo:reference id="barService" interface="com.foo.BarService" version="*" />

    另外 
    接口升级时,要注意方法: 
    * 在低压力时间段,先升级一半的提供者为新版本; 
    * 再将所有的消费者升级为新版本; 
    * 然后将剩下的一半提供者升级为新版本;

  • 相关阅读:
    c内存结构
    Linux普通文件和设备的异同点
    二分查找在字符串中的应用范例
    快排的一种相当简单但不算最快的实现方式
    C程序的存储空间布局
    exit与_exit
    /proc文件系统
    Linux下监控磁盘空间的四个命令
    linux下监控进程需掌握的四个命令
    linux终端下文件不同颜色的含义
  • 原文地址:https://www.cnblogs.com/shengulong/p/8352678.html
Copyright © 2011-2022 走看看