具有RabbitMQ集群配置属性的Spring Cloud Stream

问题描述 投票:0回答:1

我阅读了文档:https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#common-application-properties,但我不清楚这两个属性如何协同工作:

spring.rabbitmq.host=address1
spring.rabbitmq.addresses=address1,address2

我正在与多个主机组成的群集一起使用,是否只能指定addresses属性?我不希望host属性搜索localhost(如果未指定,则为默认值)。

spring-cloud-stream
1个回答
0
投票

他们不一起工作。对于单个服务器使用host(或addresses),对于集群使用addresses

[host如果提供了addresses,则将被忽略。

应该在启动文档中加以说明。

connection factory Javadocs清楚...

/**
 * Set addresses for clustering.
 * This property overrides the host+port properties if not empty.
 * @param addresses list of addresses with form "host[:port],..."
 */
public void setAddresses(String addresses) {
© www.soinside.com 2019 - 2024. All rights reserved.