dubbo

 

 

一、电商系统架构演进

  1. 单一应用架构
    所有功能部署在一起
  2. 垂直应用架构
    MVC分层
  3. 分布式服务架构
    RPC框架,将核心业务抽取出来,作为独立的服务
  4. 流动计算框架
    SOA架构模式

  

二、dubbo

  1. 什么是dubbo
    一个分布式服务框架;提供高性能、透明化的RPC远程服务调用方案;提供SOA服务治理方案


    服务提供方、服务消费方、服务注册中心、统计服务调用次数和调用时间的监控中心

  2.  provider的spring配置
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd
           http://code.alibabatech.com/schema/dubbo
           http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
        <!--定义了提供方应用信息,用于计算依赖关系;在 dubbo-admin 或 dubbo-monitor 会显示这个名字,方便辨识-->
        <dubbo:application name="demotest-provider" owner="programmer" organization="dubbox"/>
        <!--使用 zookeeper 注册中心暴露服务,注意要先开启 zookeeper-->
        <dubbo:registry address="zookeeper://localhost:2181"/>
        <!-- 用dubbo协议在20880端口暴露服务 -->
        <dubbo:protocol name="dubbo" port="20880" />
        <!--使用 dubbo 协议实现定义好的 api.PermissionService 接口-->
        <dubbo:service interface="com.alibaba.dubbo.demo.DemoService" ref="demoService" protocol="dubbo" />
        <!--具体实现该接口的 bean-->
        <bean id="demoService" class="com.alibaba.dubbo.demo.impl.DemoServiceImpl"/>
    </beans>

     



  3. consumer的spring配置
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
           http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
        <dubbo:application name="demotest-consumer" owner="programmer" organization="dubbox"/>
        <!--向 zookeeper 订阅 provider 的地址,由 zookeeper 定时推送-->
        <dubbo:registry address="zookeeper://localhost:2181"/>
        <!--使用 dubbo 协议调用定义好的 api.PermissionService 接口-->
        <dubbo:reference id="permissionService" interface="com.alibaba.dubbo.demo.DemoService"/>
    </beans>

     

 

转载于:https://www.cnblogs.com/gucl/p/8387318.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值