深入理解dubbo之服务发布源码分析

本文深入探讨了dubbo的服务发布过程,从服务接口层到服务注册层,详细分析了配置加载、服务代理、服务注册、集群、监控等核心组件。重点介绍了ServiceConfig如何装配成Invoker,通过JavassistProxyFactory实现动态代理,最终将服务暴露给消费者。通过源码阅读,总结了dubbo服务发布的五个关键步骤。
摘要由CSDN通过智能技术生成

dubbo 是阿里开源的一个分布式服务框架,它的最大特点是按照分层的方式来架构,使各层之间充分解耦,并且它是无侵入性的,dubbo可以无缝与spring整合,更重要的是dubbo还提供了强大的容错和监控功能。 对于业务方来说,dubbo使用上手足够简单,调用过程对业务方透明,对开发人员友好。

Demo

在spring项目中添加如下pom包:

 <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>dubbo</artifactId>
        </dependency>
         <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.sgroschupf</groupId>
            <artifactId>zkclient</artifactId>
        </dependency>

如果你的是springboot项目也可以用springboot的starter包

<dependency>
            <groupId>io.dubbo.springboot</groupId>
            <artifactId>spring-boot-starter-dubbo</artifactId>
            <version>1.0.0</version>
        </dependency>

添加配置文件:
spring-dubbo.xml

<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"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://code.alibabatec
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值