什么是 Spring Cloud Bus?

发送端(endpoint)构造事件event,将其publish到context上下文中(spring cloud bus 有一个父上下文,bootstrap),然后将事件发送到channel中(json串message),接收端 从channel中获取到message,将message转为事件event,然后将event事件publish到 context上下文中,最后接收端(Listener)收到event,调用服务进行处理。

整个流程中,只有发送/接收端从context上下文中取事件和发送事件是需要我们在代码中明确 写出来的,其它部分都由框架封装完成。