有两个项目A、B,各自有一定数量实现了CommonService接口的实现类,而当将这些实现类配置成dubbo服务供彼此消费时,会出现实际消费的服务并不符合预期
A项目提供两个服务并消费三个服务

<dubbo:service interface=“com.xxx.CommonService” ref=“receiveService” />
<dubbo:service interface=“com.xxx.CommonService” ref=“sendService” />
<dubbo:reference id=“asyncService” interface=“com.xxx.CommonService” />
<dubbo:reference id=“syncService” interface=“com.xxx.CommonService” />
<dubbo:reference id=“analysisService” interface=“com.xxx.CommonService” />

B项目提供三个服务并消费两个服务

<dubbo:reference interface=“com.xxx.CommonService” id=“receiveService” />
<dubbo:reference interface=“com.xxx.CommonService” id=“sendService” />
<dubbo:service ref=“asyncService” interface=“com.xxx.CommonService” />
<dubbo:service ref=“syncService” interface=“com.xxx.CommonService” />
<dubbo:service ref=“analysisService” interface=“com.xxx.CommonService” />

当在A项目中消费asyncService服务时发现实际调用的是analysisService【Bug】同一接口多实现类下dubbo调用服务错乱
针对每个服务提供者一个分组,以实现区分同一接口的不同实现类

A项目修改后的配置如下:

<dubbo:service interface=“com.xxx.CommonService” ref=“sendService”  group="sendService"/>
<dubbo:reference id=“asyncService” interface=“com.xxx.CommonService” group="asyncService"/>

B项目修改后的配置如下:

<dubbo:reference interface=“com.xxx.CommonService” id=“sendService” group="sendService"/>
<dubbo:service ref=“asyncService” interface=“com.xxx.CommonService” group="asyncService"/>

在调试过程中发现在dubbo控制台只能找到服务的提供者却看不到该服务的消费者

相关文章:

  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2022-02-12
  • 2021-11-23
  • 2021-07-01
  • 2021-12-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2021-04-14
相关资源
相似解决方案