@@ -137,7 +137,7 @@ public class CustomerHandleInitializer extends ChannelInitializer<Channel> {
137137
138138所以当应用启动每隔 10 秒会检测是否发送过消息,不然就会发送心跳信息。
139139
140- ![ ] ( https://ws3.sinaimg.cn/large/006tKfTcgy1frqd863hrhj31kw04taed .jpg )
140+ ![ ] ( https://i.loli.net/2019/07/19/5d313938a059249899 .jpg )
141141
142142## 服务端心跳
143143
@@ -286,7 +286,7 @@ public class HeartbeatInitializer extends ChannelInitializer<Channel> {
286286
287287也是同样将IdleStateHandler 添加到 ChannelPipeline 中,也会有一个定时任务,每5秒校验一次是否有收到消息,否则就主动发送一次请求。
288288
289- ![ ] ( https://ws1.sinaimg.cn/large/006tKfTcgy1frqe2hbxjfj31kw06rtej .jpg )
289+ ![ ] ( https://i.loli.net/2019/07/19/5d31393e0f8c660705 .jpg )
290290
291291因为测试是有两个客户端连上所以有两个日志。
292292
@@ -474,10 +474,10 @@ public class HeartbeatDecoder extends ByteToMessageDecoder {
474474就开启了 SpringBoot 的 actuator 监控功能,他可以暴露出很多监控端点供我们使用。
475475
476476如一些应用中的一些统计数据:
477- ![ ] ( https://ws1.sinaimg.cn/large/006tKfTcgy1frqeyocotnj31kw0b8tiy .jpg )
477+ ![ ] ( https://i.loli.net/2019/07/19/5d31393fa017351196 .jpg )
478478
479479存在的 Beans:
480- ![ ] ( https://ws3.sinaimg.cn/large/006tKfTcgy1frqez1kr3dj31kw0onawi .jpg )
480+ ![ ] ( https://i.loli.net/2019/07/19/5d31394d8fb6d16523 .jpg )
481481
482482更多信息请查看:[ https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html ] ( https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html )
483483
@@ -536,10 +536,10 @@ public class EndPointConfig {
536536这样我们就可以通过配置文件中的 ` monitor.channel.map.key ` 来访问了:
537537
538538一个客户端连接时:
539- ![ ] ( https://ws3.sinaimg.cn/large/006tKfTcgy1frqf7ic0wqj31kw07rq7a .jpg )
539+ ![ ] ( https://i.loli.net/2019/07/19/5d31394e55fe384723 .jpg )
540540
541541两个客户端连接时:
542- ![ ] ( https://ws2.sinaimg.cn/large/006tKfTcgy1frqf8omlzkj31kw07xq7y .jpg )
542+ ![ ] ( https://i.loli.net/2019/07/19/5d31395522dda45659 .jpg )
543543
544544
545545## 整合 SBA
@@ -552,7 +552,7 @@ public class EndPointConfig {
552552
553553简单来说我们可以利用该工具将 actuator 暴露出来的接口可视化并聚合的展示在页面中:
554554
555- ![ ] ( https://ws2.sinaimg.cn/large/006tKfTcgy1frqfbz359wj31kw0p513n .jpg )
555+ ![ ] ( https://i.loli.net/2019/07/19/5d313956b3aca18512 .jpg )
556556
557557接入也很简单,首先需要引入依赖:
558558
@@ -609,7 +609,7 @@ public class AdminApplication {
609609
610610这样我们在 SpringBootAdmin 的页面中就可以查看很多应用信息了。
611611
612- ![ ] ( https://ws4.sinaimg.cn/large/006tKfTcgy1frqfjuof2rj31kw10ldqk .jpg )
612+ ![ ] ( https://i.loli.net/2019/07/19/5d31395886b8e59039 .jpg )
613613
614614更多内容请参考官方指南:
615615
@@ -668,21 +668,21 @@ public class IndexController {
668668
669669当我们调用该接口时:
670670
671- ![ ] ( https://ws4.sinaimg.cn/large/006tKfTcgy1frqfv3vx0ej31hk0g6dj5 .jpg )
671+ ![ ] ( https://i.loli.net/2019/07/19/5d313960a3a9826851 .jpg )
672672
673- ![ ] ( https://ws4.sinaimg.cn/large/006tKfTcgy1frqfvof9lpj31kw07l0z8 .jpg )
673+ ![ ] ( https://i.loli.net/2019/07/19/5d3139634d9e553115 .jpg )
674674
675675在监控页面中可以查询刚才的调用情况:
676676
677- ![ ] ( https://ws4.sinaimg.cn/large/006tKfTcgy1frqfwembi6j31kw0o0dot .jpg )
677+ ![ ] ( https://i.loli.net/2019/07/19/5d313964b932568620 .jpg )
678678
679679服务端主动 push 消息也是类似,只是需要在发送时候根据客户端的 ID 查询到具体的 Channel 发送:
680680
681- ![ ] ( https://ws4.sinaimg.cn/large/006tKfTcgy1frqfy9dcu5j31hu0f277i .jpg )
681+ ![ ] ( https://i.loli.net/2019/07/19/5d31396c18f0c66961 .jpg )
682682
683- ![ ] ( https://ws2.sinaimg.cn/large/006tKfTcgy1frqfz0aticj31kw05jgol .jpg )
683+ ![ ] ( https://i.loli.net/2019/07/19/5d313aacddff648185 .jpg )
684684
685- ![ ] ( https://ws3.sinaimg.cn/large/006tKfTcgy1frqfztzxd8j31kw0iyn0t .jpg )
685+ ![ ] ( https://i.loli.net/2019/07/19/5d313aada4d3082044 .jpg )
686686
687687
688688# 总结
0 commit comments