diff --git a/build.gradle b/build.gradle index 2598d51..06e471b 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ ext { springVersion = "3.1.4.RELEASE" tomcatVersion = "7.0.53" - springAmqpVersion = "1.0.0.RELEASE" + springAmqpVersion = "1.3.6.RELEASE" springDataRedisVersion = "1.1.1.RELEASE" springDataMongoVersion = "1.2.4.RELEASE" diff --git a/spring-cloud-spring-service-connector/src/main/java/org/springframework/cloud/service/messaging/RabbitConnectionFactoryCreator.java b/spring-cloud-spring-service-connector/src/main/java/org/springframework/cloud/service/messaging/RabbitConnectionFactoryCreator.java index 7ca878c..a32db74 100644 --- a/spring-cloud-spring-service-connector/src/main/java/org/springframework/cloud/service/messaging/RabbitConnectionFactoryCreator.java +++ b/spring-cloud-spring-service-connector/src/main/java/org/springframework/cloud/service/messaging/RabbitConnectionFactoryCreator.java @@ -19,19 +19,12 @@ public class RabbitConnectionFactoryCreator extends AbstractServiceConnectorCrea @Override public ConnectionFactory create(AmqpServiceInfo serviceInfo, ServiceConnectorConfig serviceConnectorConfiguration) { com.rabbitmq.client.ConnectionFactory connectionFactory = new com.rabbitmq.client.ConnectionFactory(); - connectionFactory.setHost(serviceInfo.getHost()); - connectionFactory.setVirtualHost(serviceInfo.getVirtualHost()); - connectionFactory.setUsername(serviceInfo.getUserName()); - connectionFactory.setPassword(serviceInfo.getPassword()); - if ("amqps".equals(serviceInfo.getScheme())) { - try { - connectionFactory.useSslProtocol(); - } - catch (Exception e) { - throw new IllegalStateException("failed to configure SSL protocol", e); - } + try { + connectionFactory.setUri(serviceInfo.getUri()); + } + catch (Exception e) { + throw new IllegalArgumentException("failed to create ConnectionFactory", e); } - connectionFactory.setPort(serviceInfo.getPort()); CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(connectionFactory); if (serviceConnectorConfiguration != null) { cachingConnectionFactory.setChannelCacheSize(((RabbitConnectionFactoryConfig)serviceConnectorConfiguration).getChannelCacheSize());