6. 自定义 Message Broker
Spring Cloud Bus 使用 Spring Cloud Stream
广播消息。因此,要使消息流向,您只需包含 Binder
在 Classpath 中选择的实现。巴士有方便的Starters
使用 AMQP (RabbitMQ) 和 Kafka (spring-cloud-starter-bus-[amqp|kafka]
).一般
说来,Spring Cloud Stream 依赖于 Spring Boot 自动配置约定
配置中间件。例如,可以使用spring.rabbitmq.*
configuration 属性。Spring Cloud Bus 有少量
中的 native configuration propertiesspring.cloud.bus.*
(例如,spring.cloud.bus.destination
是要用作外部
中间件)。通常,默认值就足够了。
要了解有关如何自定义消息代理设置的更多信息,请参阅 Spring Cloud 流文档。