title: How can I connect to multiple Rabbitmq nodes with Spring Rabbitmq?
body: <p>I am writing a service with Spring and I am using Spring AMQP in order to connect to Rabbitmq.</p>
  
  <p>I have two rabbitmq clusters, one is only for publishing messages(the messages are sent to the other cluster via the federation plugin) and the other cluster is for declaring queues that end users will consume from.</p>
  
  <p>The nodes sit behind aws lb, each cluster has a lb.</p>
  
  <p>I am using CachingConnectionFactory and RabbitTemplate,RabbitAdmin in my code and I want to have connections to all the nodes so I can use them.
  For the cluster that will contain the queues I added to the config the queue-master-locator=random so new queues will be declared in all the nodes in the cluster even if my service does not have a connection to them.</p>
  
  <p>With the cluster that publishes messages I have more of a problem because I need a direct connection in my service to each of the nodes so I will be able to separate the load between the nodes.</p>
  
  <p>So my problem is, how do I create connections in my service to all the nodes in the cluster so they will all be used for declaring queues and sending messages?</p>
  
  <p>Now, after I will have some sort of solution to this issue, the next issue will be what happens when a new node is added to the cluster? How can I create a connection to it and start using it as well?</p>
  
  <p>I am using Rabbitmq - 3.7.9, Spring - 2.0.5, Spring AMQP - 2.0.5</p>
  
  <p>Thanks alot!</p>