group and version in dubbo

group

When an interface has multiple implementations, it can be distinguished by 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" />

In addition, dubbo consumers can also be set to consume services from any group.

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

version

When the implementation of an interface is incompatible with the upgrade, the version number can be used for transition, and services with different version numbers do not refer to each other.

<!-- 机器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" />

In addition, when consumers consume any version of the service:

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

In addition 
, when upgrading the interface, pay attention to the method: 
* During the low pressure period, first upgrade half of the providers to the new version; 
* Then upgrade all consumers to the new version; 
* Then upgrade the remaining half of the providers toVersion;

 

 

https://blog.csdn.net/silencecarrot/article/details/66981333

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326132952&siteId=291194637