当前位置: 首页 > news >正文

网站在线搭建系统永州市规划建设局网站

网站在线搭建系统,永州市规划建设局网站,flash制作动画教程,商业网站规划目录 🧂1.Bus是什么❤️❤️❤️ 🌭2.什么是总线❤️❤️❤️ 🥓3.rabbitmq❤️❤️❤️ 🥞4.新建模块3366❤️❤️❤️ 🍳5.设计思想 ❤️❤️❤️ 🍿6.添加消息总线的支持❤️❤️❤️ &#x1f9…

目录

🧂1.Bus是什么❤️❤️❤️

🌭2.什么是总线❤️❤️❤️

🥓3.rabbitmq❤️❤️❤️

🥞4.新建模块3366❤️❤️❤️

🍳5.设计思想 ❤️❤️❤️

🍿6.添加消息总线的支持❤️❤️❤️

🥚7.定点通知❤️❤️❤️


1.Bus是什么❤️❤️❤️

  • SpringCloud Bus是将分布式系统的节点轻量级消息系统链接起来的框架
  • 整合了Java的事件处理机制和消息中间件的功能
  • 目前支持RabbitMQKafka。
  • Spring Cloud Bus配合Spring Cloud Config使用可以实现配置的动态刷新。

2.什么是总线❤️❤️❤️

在微服务架构的系统中,通常会使用轻量级的消息代理来构建一个共用的消息主题,并让系统中所有微服务实例都连接上来。由于该主题中产生的消息会被所有实例监听消费,所以称它为消息总线。在总线上的各个实例,都可以方便地广播一些需要让其他连接在该主题上的实例都知道的消息。

3.rabbitmq❤️❤️❤️

虚拟机上安装好rabbitmq

安装详细请看小张的—>从入门到精通RabbitMQ

4.新建模块3366❤️❤️❤️

4.1.建模块❤️❤️

  • 1.在父工程下创建模块
  • 2.注意jdk和maven版本号

4.2.加pom❤️❤️

    <dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.example</groupId><artifactId>cloud-api-commons</artifactId><version>${project.version}</version></dependency><!--eureka的Client端--><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId></dependency><!--configClient--><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-config</artifactId></dependency></dependencies>

4.3.改yml❤️❤️

server:port: 3366
spring:application:name: config-clientcloud:config:label: masterprofile: devname: configuri: http://localhost:3344eureka:client:service-url:defaultZone:  http://eureka7001.com:7001/eureka,http://eureka7002.com:7002/eureka,http://eureka7003.com:7003/eureka#暴露监控端点
management:endpoints:web:exposure:include: "*"

4.4.主启动类❤️❤️

@SpringBootApplication
@EnableEurekaClient
public class ConfigClientMain3366 {public static void main(String[] args) {SpringApplication.run(ConfigClientMain3366.class);}
}

4.5.业务类❤️❤️

@RestController
@RefreshScope
public class ConfigClientController {@Value("${server.port}")private String serverPort;@Value("${config.info}")private String configInfo;@GetMapping("/configInfo")public String getConfigInfo() {return "serverPort:" + serverPort + "\t\t" +",configInfo:"+configInfo;}
}

5.设计思想 ❤️❤️❤️

利用消息总线触发一个服务端ConfigServer的/bus/refresh端点,而刷新所有客户端的配置

6.添加消息总线的支持❤️❤️❤️

6.1.修改3344模块❤️❤️

1.改pom❤️❤️

添加消息总线依赖

        <!--消息总线RabbitMq--><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-bus-amqp</artifactId></dependency>

2.改yml❤️❤️

添加rabbitmq配置,并暴露刷新端点

server:port: 3344spring:application:name:  cloud-config-centercloud:config:server:git:#gitee上面的仓库地址uri: git@gitee.com:hqdmdxz/springcould-config.git#搜索目录search-paths:- sprongcloud-config#gitee的账号username: 18337062987#gitee的密码password: love4.29#读取分支lable: master#rabbitmq配置rabbitmq:host: 192.168.20.129port: 5672username: rootpassword: 123456#注册到eureka
eureka:client:service-url:defaultZone: http://eureka7001.com:7001/eureka,http://eureka7002.com:7002/eureka,http://eureka7003.com:7003/eureka#暴露bus刷新配置的端点
management:endpoints:web:exposure:include: 'bus-refresh'

6.2.修改3355模块❤️❤️

1.改pom❤️❤️

 添加消息总线依赖

        <!--消息总线RabbitMq--><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-bus-amqp</artifactId></dependency>

2.改yml❤️❤️

server:port: 3355
spring:application:name: config-clientcloud:#客户端配置config:#分支名称label: master#配置文件名称name: config#读取后缀名称profile: dev#配置中心地址uri: http://localhost:3344rabbitmq:host: 192.168.20.129port: 5672username: rootpassword: 123456
#服务注册到eureka
eureka:client:service-url:defaultZone: http://eureka7001.com:7001/eureka,http://eureka7002.com:7002/eureka,http://eureka7003.com:7003/eureka#暴露监控端点
management:endpoints:web:exposure:include: "*"

6.3.修改3366模块❤️❤️

1.改pom❤️❤️

 添加消息总线依赖

        <!--消息总线RabbitMq--><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-bus-amqp</artifactId></dependency>

2.改yml❤️❤️

server:port: 3366
spring:application:name: config-clientcloud:#客户端配置config:#分支名称label: master#配置文件名称name: config#读取后缀名称profile: dev#配置中心地址uri: http://localhost:3344rabbitmq:host: 192.168.20.129port: 5672username: rootpassword: 123456
#服务注册到eureka
eureka:client:service-url:defaultZone: http://eureka7001.com:7001/eureka,http://eureka7002.com:7002/eureka,http://eureka7003.com:7003/eureka#暴露监控端点
management:endpoints:web:exposure:include: "*"

6.4.测试❤️❤️

1.启动eureka集群,config配置中心3344,服务3355,服务3366。

2.手动刷新服务3344,一刷新处处生效

2.在gitee上修改版本号,浏览器查看3344,3355,3366. 

7.定点通知❤️❤️

  • 不想全部通知,只想顶点通知3355,不通知3366

公式:

http://localhost:配置中心的端口号/actuator/bus-refresh/{destination)

 至此消息总线基本拿捏~

 

http://www.yayakq.cn/news/587661/

相关文章:

  • 网站标头设计程序开发外包平台
  • 台州企业网站WordPress建影视站
  • 建一网站要多少钱网站验收模版
  • 番禺做网站哪家专业电子商务网站建设与安全
  • 网站建设公司不让放自己空间站怎么seo网站推广
  • 类似聚划算的网站怎么建设广告推广计划
  • 用网站做淘客怎么赚钱网站推广免费 优帮云
  • 网站设计与制作的流程北京市住房建设投资中心网站
  • 购物网站开发大纲修改默认头像wordpress
  • 网站建栏目建那些网站开发周期价格
  • 淘宝客网站免费建设服饰网站新闻建设
  • 携程网站建设要求一个公司多个网站做优化
  • 网站设计深圳网站建设的十点优势
  • 威县做网站哪儿便宜自己如何优化网站排名
  • 免费个人网站申请北京档案馆网站建设
  • 精品课网站怎么做wordpress 作者链接
  • 找网站做外链是什么意思肇庆市端州发布
  • 重庆自助建站模板室内设计平面图怎么画
  • 商贸网站做网站有流量就有收入吗
  • win8网站模板怎么建投票网站
  • 汕头建站模板系统彩票网站开发租用
  • 商城网站的功能无忧商务网
  • 商务网站建设哪家好做响应式的网站
  • 泉州网站模板建站做公司网站需要花钱吗
  • 杭州网站建设官方蓝韵网络商业空间设计的内容包括哪些
  • 企业做网站这些问题必须要注意网站开发如何让图片加载的更快
  • 网站推广文章范例企业网址
  • 嘉兴网站关键词排名怎么制作php网站
  • 怎么做网站主wordpress网银插件
  • 定州网站设计wordpress虚拟3d网站