From afa5759dcfed8dc36e593d04a4752e57cce84a1b Mon Sep 17 00:00:00 2001 From: dsyer Date: Sun, 13 Mar 2011 15:18:14 +0000 Subject: [PATCH] Update samples to use CachingConnectionFactory --- .../amqp/helloworld/HelloWorldConfiguration.java | 4 ++-- .../amqp/helloworld/async/ProducerConfiguration.java | 4 ++-- .../stocks/config/AbstractStockAppRabbitConfiguration.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/helloworld/src/main/java/org/springframework/amqp/helloworld/HelloWorldConfiguration.java b/helloworld/src/main/java/org/springframework/amqp/helloworld/HelloWorldConfiguration.java index 439a375..395344a 100644 --- a/helloworld/src/main/java/org/springframework/amqp/helloworld/HelloWorldConfiguration.java +++ b/helloworld/src/main/java/org/springframework/amqp/helloworld/HelloWorldConfiguration.java @@ -2,8 +2,8 @@ package org.springframework.amqp.helloworld; import org.springframework.amqp.core.Queue; import org.springframework.amqp.rabbit.config.AbstractRabbitConfiguration; +import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.springframework.amqp.rabbit.connection.ConnectionFactory; -import org.springframework.amqp.rabbit.connection.SingleConnectionFactory; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -15,7 +15,7 @@ public class HelloWorldConfiguration extends AbstractRabbitConfiguration { @Bean public ConnectionFactory connectionFactory() { - SingleConnectionFactory connectionFactory = new SingleConnectionFactory("localhost"); + CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost"); connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); return connectionFactory; diff --git a/helloworld/src/main/java/org/springframework/amqp/helloworld/async/ProducerConfiguration.java b/helloworld/src/main/java/org/springframework/amqp/helloworld/async/ProducerConfiguration.java index 4d3784d..821f12b 100644 --- a/helloworld/src/main/java/org/springframework/amqp/helloworld/async/ProducerConfiguration.java +++ b/helloworld/src/main/java/org/springframework/amqp/helloworld/async/ProducerConfiguration.java @@ -3,8 +3,8 @@ package org.springframework.amqp.helloworld.async; import java.util.concurrent.atomic.AtomicInteger; import org.springframework.amqp.rabbit.config.AbstractRabbitConfiguration; +import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.springframework.amqp.rabbit.connection.ConnectionFactory; -import org.springframework.amqp.rabbit.connection.SingleConnectionFactory; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanPostProcessor; @@ -27,7 +27,7 @@ public class ProducerConfiguration extends AbstractRabbitConfiguration { @Bean public ConnectionFactory connectionFactory() { - SingleConnectionFactory connectionFactory = new SingleConnectionFactory("localhost"); + CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost"); connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); return connectionFactory; diff --git a/stocks/src/main/java/org/springframework/amqp/rabbit/stocks/config/AbstractStockAppRabbitConfiguration.java b/stocks/src/main/java/org/springframework/amqp/rabbit/stocks/config/AbstractStockAppRabbitConfiguration.java index d30e6a3..a42e06d 100644 --- a/stocks/src/main/java/org/springframework/amqp/rabbit/stocks/config/AbstractStockAppRabbitConfiguration.java +++ b/stocks/src/main/java/org/springframework/amqp/rabbit/stocks/config/AbstractStockAppRabbitConfiguration.java @@ -19,7 +19,7 @@ package org.springframework.amqp.rabbit.stocks.config; import org.springframework.amqp.core.TopicExchange; import org.springframework.amqp.rabbit.config.AbstractRabbitConfiguration; import org.springframework.amqp.rabbit.connection.ConnectionFactory; -import org.springframework.amqp.rabbit.connection.SingleConnectionFactory; +import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.support.converter.JsonMessageConverter; import org.springframework.amqp.support.converter.MessageConverter; @@ -58,7 +58,7 @@ public abstract class AbstractStockAppRabbitConfiguration extends AbstractRabbit @Bean public ConnectionFactory connectionFactory() { //TODO make it possible to customize in subclasses. - SingleConnectionFactory connectionFactory = new SingleConnectionFactory("localhost"); + CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost"); connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); return connectionFactory;