W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
可以通過設(shè)置spring.cloud.bus.trace.enabled=true
來跟蹤Bus事件(RemoteApplicationEvent
的子類)。如果這樣做,Spring Boot TraceRepository
(如果存在)將顯示發(fā)送的每個事件以及每個服務(wù)實例的所有確認。以下示例來自/trace
端點:
{ "timestamp": "2015-11-26T10:24:44.411+0000", "info": { "signal": "spring.cloud.bus.ack", "type": "RefreshRemoteApplicationEvent", "id": "c4d374b7-58ea-4928-a312-31984def293b", "origin": "stores:8081", "destination": "*:**" } }, { "timestamp": "2015-11-26T10:24:41.864+0000", "info": { "signal": "spring.cloud.bus.sent", "type": "RefreshRemoteApplicationEvent", "id": "c4d374b7-58ea-4928-a312-31984def293b", "origin": "customers:9000", "destination": "*:**" } }, { "timestamp": "2015-11-26T10:24:41.862+0000", "info": { "signal": "spring.cloud.bus.ack", "type": "RefreshRemoteApplicationEvent", "id": "c4d374b7-58ea-4928-a312-31984def293b", "origin": "customers:9000", "destination": "*:**" } }
前面的跡線顯示RefreshRemoteApplicationEvent
從customers:9000
發(fā)送,廣播到所有服務(wù),并由customers:9000
和stores:8081
接收(確認)。
要自己處理確認信號,您可以為應(yīng)用程序中的AckRemoteApplicationEvent
和SentApplicationEvent
類型添加一個@EventListener
(并啟用跟蹤)。或者,您可以點擊TraceRepository
并從那里挖掘數(shù)據(jù)。
任何Bus應(yīng)用程序都可以跟蹤acks。但是,有時,在中央服務(wù)中執(zhí)行此操作很有用,該服務(wù)可以對數(shù)據(jù)進行更復雜的查詢,或?qū)⑵滢D(zhuǎn)發(fā)給專門的跟蹤服務(wù)。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: