dubbo源码 学习笔记(三)
来源:互联网 发布:vb清除窗体内容 编辑:程序博客网 时间:2024/05/28 15:07
不使用spring配置 的 dubbo例子
生产者
public class Provider {public static void main(String[] args) throws IOException {ApplicationConfig app = new ApplicationConfig();app.setName("provider");RegistryConfig registry = new RegistryConfig("zookeeper://127.0.0.1:2181");ProtocolConfig protocol = new ProtocolConfig("dubbo", 20880);ServiceConfig<TService> service = new ServiceConfig<TService>();service.setInterface(TService.class);service.setRef(new TServiceImpl());service.setProtocol(protocol);service.setRegistry(registry);service.setApplication(app);service.export();System.in.read(); // 按任意键退出}}
消费者
public class Consumer {public static void main(String[] args) {ApplicationConfig app = new ApplicationConfig();app.setName("consumer");RegistryConfig registry = new RegistryConfig("zookeeper://127.0.0.1:2181");ReferenceConfig<TService> reference = new ReferenceConfig<TService>();reference.setApplication(app);reference.setRegistry(registry);reference.setInterface(TService.class);reference.setCheck(false);TService t = reference.get();System.out.println(t.say("sb"));}}
通过此例子 理解dubbo运行原理
阅读全文
0 0
- dubbo源码 学习笔记(三)
- dubbo 源码学习笔记 (三) —— dubbo引用服务的过程
- dubbo源码 学习笔记(一)
- dubbo源码 学习笔记(二)
- dubbo源码 学习笔记(四)
- dubbo源码 学习笔记(五)
- dubbo源码 学习笔记(六)
- dubbo学习笔记 一 源码编译
- dubbo学习笔记 三 架构预览
- Dubbo学习笔记(三) Provider和Consumer
- Dubbo框架学习笔记(三)
- dubbo源码学习(三)基础知识:spring 自定义标签
- dubbo源码学习
- dubbo源码学习
- nginx 源码学习笔记(三)
- RealVNC源码学习笔记 三
- Dubbo 源码学习笔记 —— SPI的机制体现
- dubbo 源码学习笔记 (四) —— 配置模块
- 用bootstrap做一个背景可轮转的登录界面
- 移动Web开发基础-百分比+flex布局方案
- AJAX如何现实跨域请求?
- jenkins api 接口json 调用
- Swift桥接OC Objective-OC Bridging Header
- dubbo源码 学习笔记(三)
- Win7 flash 在线观看视频蓝屏解决方法
- bzoj1179: [Apio2009]Atm tarjan+spfa
- 编写高质量的代码——从命名入手
- linux设备驱动程序第3版 ——第5章
- QCustomPlot使用手册(一)
- Qt5下实现摄像头预览及捕获图像方法二(openCV3与Qt5交互使用)
- 自定义View高度大于屏幕高度显示不全解决方案
- Linux基础06-高级文本处理命令