Upgraded Spring AMQP to 1.3.6

Creating Rabbit ConnectionFactory by passing the URI from AmqpServiceInfo.
This commit is contained in:
Mark Fisher
2014-10-31 14:33:17 -04:00
parent 1c826dad34
commit fd9b380727
2 changed files with 6 additions and 13 deletions

View File

@@ -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"

View File

@@ -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());