Dubbo使用技巧
Dubbo使用技巧
1. 只订阅不注册
1 | |
2. 直连提供者的方式
JVM启动参数中指定提供者的URL
1
java -D com.alibaba.xxx.XxxService=dubbo://localhost:20890在reference调用位置指定提供者的URL
1
<debbo.reference url="dubbo://localhost:20890" interfaceClass="com.alibaba.xxx.XxxService"/>或
1
2@DubboReference(url="dubbo://localhost:20890")
private DubboDemoService demoService;
3.指定group分组
目的是隔离不同的环境,比如测试、开发、或者自己本地的环境
使用:分别在
<dubbo:consumer/>和<dubbo:provider/>添加group属性并自定义组名
4. version
当一个接口的实现,出现不兼容升级时,可以用版本号过渡,版本号不同的服务相互间不引用
1 | |
Dubbo使用技巧
http://example.com/2022/05/16/Middleware/Dubbo使用技巧/