From 0b738513d00b90b352d7c7613cd91a740a1300fc Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 31 Mar 2011 13:45:38 +0100 Subject: [PATCH] Fix config before RC1 --- .../amqp/helloworld/HelloWorldConfiguration.java | 8 ++++++++ .../amqp/helloworld/async/ProducerConfiguration.java | 1 + helloworld/src/main/resources/rabbitConfiguration.xml | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) 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 4a37b26..7621357 100644 --- a/helloworld/src/main/java/org/springframework/amqp/helloworld/HelloWorldConfiguration.java +++ b/helloworld/src/main/java/org/springframework/amqp/helloworld/HelloWorldConfiguration.java @@ -1,8 +1,10 @@ package org.springframework.amqp.helloworld; +import org.springframework.amqp.core.AmqpAdmin; import org.springframework.amqp.core.Queue; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.springframework.amqp.rabbit.connection.ConnectionFactory; +import org.springframework.amqp.rabbit.core.RabbitAdmin; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -19,7 +21,13 @@ public class HelloWorldConfiguration { connectionFactory.setPassword("guest"); return connectionFactory; } + + @Bean + public AmqpAdmin amqpAdmin() { + return new RabbitAdmin(connectionFactory()); + } + @Bean public RabbitTemplate rabbitTemplate() { RabbitTemplate template = new RabbitTemplate(connectionFactory()); //The routing key is set to the name of the queue by the broker for the default exchange. 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 947ee33..b7cf542 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 @@ -17,6 +17,7 @@ public class ProducerConfiguration { protected final String helloWorldQueueName = "hello.world.queue"; + @Bean public RabbitTemplate rabbitTemplate() { RabbitTemplate template = new RabbitTemplate(connectionFactory()); template.setRoutingKey(this.helloWorldQueueName); diff --git a/helloworld/src/main/resources/rabbitConfiguration.xml b/helloworld/src/main/resources/rabbitConfiguration.xml index 970f935..1b561e1 100644 --- a/helloworld/src/main/resources/rabbitConfiguration.xml +++ b/helloworld/src/main/resources/rabbitConfiguration.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - +