欢迎来到代码驿站!

JAVA代码

当前位置:首页 > 软件编程 > JAVA代码

spring cloud 的监控turbine-rabbitmq的示例

时间:2022-01-09 11:07:47|栏目:JAVA代码|点击:

前提是你已经有了注册中心,然后搭建一个基础spring cloud 服务,并配置注册服务等等前提环境搭建

接下来描述的服务提供者和服务调用者的配置都是一样的,来自《spring cloud 与 docker微服务架构实战》的读后的个人总结.

pom文件中需要引入spring-cloud-starter-hystrix/spring-cloud-starter-hystrix-dashboard/spring-cloud-netflix-hystrix-stream/spring-cloud-starter-turbine-stream/spring-cloud-starter-stream-rabbit
如下

<dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
<dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-netflix-hystrix-stream</artifactId>
</dependency>
<dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-starter-turbine-stream</artifactId>
</dependency>
<dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>

启动类需要添加如下注解

/*turibine监控*/
@EnableTurbineStream
@EnableCircuitBreaker
/*Dashboard监控*/
@EnableHystrixDashboard

接下来的操作才是关键

1,将注册中心 服务提供者 服务调用者 都启动

2.访问服务提供者 ip:port/hystrix 如图

 

3. 图中总共有三个文本框,其中第一个文本框是必填的,填写的是服务调用者的 ip:port/hystrix.stream,然后点击Monitor Stream.

 

4. 注意,如果第一个文本框填写的不正确会展示如下内容

 

5. 访问服务调用者,当然,该服务调用者提供的接口需要调用服务提供者提供的接口的

6.这时候就能看到如下内容,就证明你成功了

访问hystrix.stream

访问该连接时,想要出现如下的情况

 

这个就要访问服务提供者的 ip:port/hystrix.stream

上一篇:java 排序算法之希尔算法

栏    目:JAVA代码

下一篇:springboot如何实现自动装配源码解读

本文标题:spring cloud 的监控turbine-rabbitmq的示例

本文地址:http://www.codeinn.net/misctech/189654.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有