spring-cloud是如何通过bus-refresh刷新配置的

  1. request /actuator/bus-refresh

  2. BusRefreshEndpoint received request

  3. ApplicationEventPublisher.publish(RemoteApplicationEvent)

  4. BusAutoConfiguration#

1
2
3
4
5
6
7
8
9
10
11
@EventListener(classes = RemoteApplicationEvent.class)
public void acceptLocal(RemoteApplicationEvent event) {
if (this.serviceMatcher.isFromSelf(event)
&& !(event instanceof AckRemoteApplicationEvent)) {
if (log.isDebugEnabled()) {
log.debug("Sending remote event on bus: " + event);
}
//rabitmqTemplate send messsage
this.cloudBusOutboundChannel.send(MessageBuilder.withPayload(event).build());
}
}