finchley版本,使用bus自动刷新所有客户端时候遇到的问题

首先,finchley版本对于引入bus的配置,在pom中引入的包和书中描述的一样,是这个:

org.springframework.cloud

spring-cloud-starter-bus-amqp

再次,在finchley版本中,对于节点的刷新不再是/bus/refresh节点,这个可以从客户端启动时候的日志中看到,会有类似

2018-10-24 17:39:08.252 INFO 13632 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/refresh],methods=[POST],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)

这样的日志打出,但是,当启动后,访问链接:

localhost:8081/profile      localhost:8082/profile   都能正确打印出配置信息。

使用terminal刷新其中一个节点:curl -X POST http://ip:8082/actuator/refresh,刷新后发现只有8082端口被刷新,并没有全部刷新,查了下资料,原来还有这个接口:

curl -X POST http://ip:8082/actuator/bus-refresh,使用这个接口后,两个客户端都得到了刷新。

备注:在terminal窗口发送刷新请求到服务端的时候,服务端和每个客户端的控制台都会打印相应的日志。

你可能感兴趣的:(finchley版本,使用bus自动刷新所有客户端时候遇到的问题)