溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

spring cloud 的監(jiān)控turbine-rabbitmq的示例

發(fā)布時間:2020-10-03 11:47:20 來源:腳本之家 閱讀:167 作者:菜鳥阿達 欄目:編程語言

前提是你已經(jīng)有了注冊中心,然后搭建一個基礎(chǔ)spring cloud 服務(wù),并配置注冊服務(wù)等等前提環(huán)境搭建

接下來描述的服務(wù)提供者和服務(wù)調(diào)用者的配置都是一樣的,來自《spring cloud 與 docker微服務(wù)架構(gòu)實戰(zhàn)》的讀后的個人總結(jié).

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監(jiān)控*/
@EnableTurbineStream
@EnableCircuitBreaker
/*Dashboard監(jiān)控*/
@EnableHystrixDashboard

接下來的操作才是關(guān)鍵

1,將注冊中心 服務(wù)提供者 服務(wù)調(diào)用者 都啟動

2.訪問服務(wù)提供者 ip:port/hystrix 如圖

spring cloud 的監(jiān)控turbine-rabbitmq的示例 

3. 圖中總共有三個文本框,其中第一個文本框是必填的,填寫的是服務(wù)調(diào)用者的 ip:port/hystrix.stream,然后點擊Monitor Stream.

spring cloud 的監(jiān)控turbine-rabbitmq的示例 

4. 注意,如果第一個文本框填寫的不正確會展示如下內(nèi)容

spring cloud 的監(jiān)控turbine-rabbitmq的示例 

5. 訪問服務(wù)調(diào)用者,當(dāng)然,該服務(wù)調(diào)用者提供的接口需要調(diào)用服務(wù)提供者提供的接口的

6.這時候就能看到如下內(nèi)容,就證明你成功了

spring cloud 的監(jiān)控turbine-rabbitmq的示例

訪問hystrix.stream

訪問該連接時,想要出現(xiàn)如下的情況

spring cloud 的監(jiān)控turbine-rabbitmq的示例 

這個就要訪問服務(wù)提供者的 ip:port/hystrix.stream

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持億速云。

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI