We have a three-node RabbitMQ cluster.

We configure a RabbitProperties bean with (among other necessary config) calling .setAddresses(), providing details of all three nodes.

We noticed issues occurring when the first node of the three was in a bad state (e.g. high memory usage), but the other two were fine.

From code reading https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java#L139 it appears to me that the first address will always be used.

Have I misunderstood?

Assuming not, then can you please help me to understand why such an apparently naive model is being used here?

Comment From: wilkinsona

All of the addresses are passed to Spring AMQP's CachingConnectionFactory:

https://github.com/spring-projects/spring-boot/blob/04d6b21dfbbd24aec57241619b9e3d2d8d48a1df/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java#L102

These addresses are ultimately passed down to Rabbit MQ's Java client where I believe it connects to the first address that is available. If this isn't working, or isn't working as you expect, please raise it with the Spring AMQP or Rabbit team. If it turns out that something is being misconfigured by Spring Boot, please let us know and we can re-open this issue and take another look.