Spring Cloud Alibaba Dubbo 整合入门

约定不等于承诺〃 2023-02-13 11:57 82阅读 0赞

微服务这个概念在行业上出现许久时间了,其它我在工作前几年就一直都在用微服务的模式开发了,那时用的还是
Dubbo+springmvc+hession,后面Spring Source后出了分布式的解决方案SpringCloud,SpringCloud包括很多的组件netflix Eureka、Ribbon、netflix Hystrix、Zuul等,最近也在考虑技术选行,
了解到了很多的netflix下的开源构架停更了,停更了表示出现BUG后,无人可以解决了
于是通过网上了解到阿里针对微服务也提出整体解决方案SpringCloud+Aliababa Nacos+sentinel+LoadBlancer+Nacos config+getway等.
Dubbo和Spring Cloud各有千秋,那如何了整合在项目只用他们的优点?Spring Cloud Alibaba Dubbo?

简介

  1. Dubbo Spring Cloud 首个 Preview Release,随同 Spring Cloud Alibaba 0.2.2.RELEASE 0.9.0.RELEASE 一同发布[2], 分别对应 Spring Cloud Finchley[3] Greenwich[4] (下文分别简称为 F G 版)








































功能组件 Spring Cloud Dubbo Spring Cloud
分布式配置(Distributed configuration) Git、Zookeeper、Consul、JDBC Spring Cloud 分布式配置 + Dubbo 配置中心
服务注册与发现(Service registration and discovery) Eureka、Zookeeper、Consul Spring Cloud 原生注册中心 + Dubbo 原生注册中心
负载均衡(Load balancing)) 负载均衡(Load balancing) Dubbo 内建实现(随机、轮询等算法 + 权重等特性)
服务熔断(Circuit Breakers) Git、Zookeeper、Consul、JDBC Spring Cloud 分布式配置 + Dubbo 配置中心
服务调用(Service-to-service calls) Open Feign、RestTemplate Spring Cloud 服务调用 + Dubbo @Reference
链路跟踪(Tracing) Spring Cloud Sleuth+ Zipkin Zipkin、opentracing 等

快速入门

在这里插入图片描述
dubbo-spring-cloud-api–接口的定义
dubbo-spring-cloud-provider -提供者,功能的提供方
dubbo-spring-cloud-consumer —消费者

搭建 API 项目

  1. public interface IHelloService {
  2. String sayHello(String hello);
  3. }

定义接口类

搭建提供者项目

快速消费者项目

快速入门

发表评论

表情:
评论列表 (有 0 条评论,82人围观)

还没有评论,来说两句吧...

相关阅读