private ConnectionFactory determineConnectionFactory(String queue) {
		for (int i = 0; i < this.adminAdresses.length; i++) {
			String adminUri = this.adminAdresses[i];
			RestTemplate template = createRestTemplate(adminUri);
			URI uri = UriComponentsBuilder.fromUriString(adminUri + "/api")
					.pathSegment("queues", "{vhost}", "{queue}")
					.buildAndExpand(this.vhost, queue).encode().toUri();
			try {
				@SuppressWarnings("unchecked")
				Map<String, Object> queueInfo = template.getForObject(uri, Map.class);
				if (queueInfo != null) {
					String node = (String) queueInfo.get("node");
					if (node != null) {
						for (int j = 0; j < this.nodes.length; j++) {
							if (this.nodes[j].equals(node)) {
								return nodeConnectionFactory(queue, j);
							}
						}
					}
				}
			}
			catch (Exception e) {
				logger.error("Failed to determine queue location for: " + queue + " at: " +
						uri.toString(), e);
			}
		}
		logger.warn("Failed to determine queue location for: " + queue);
		return null;
	}
@param defaultConnectionFactory the fallback connection factory to use if the queue can't be located.
@param addresses the rabbitmq server addresses (host:port, ...).
@param adminAddresses the rabbitmq admin addresses (http://host:port, ...) must
be the same length as addresses.
@param nodes the rabbitmq nodes corresponding to addresses (rabbit@server1, ...).
@param vhost the virtual host.
@param username the user name.
@param password the password.
@param useSSL flag to enable SSL.
@param sslPropertiesLocation location of SSL properties file. If this is set, the
following parameters are not used.
@param keyStore the key store location if not using properties file.
@param keyStorePassphrase the key store passphrase if not using properties file.
@param trustStore the trust store location if not using properties file.
@param truststorePassphrase the trust store passphrase if not using properties
file.
spring-xd-messagebus-rabbit/src/main/java/org/springframework/xd/dirt/integration/rabbit/LocalizedQueueConnectionFactory.java