add declareQueue to AmqpAdmin interface

additiona docs
XML example to configure AmqpAdmin implementations
This commit is contained in:
markpollack
2010-07-15 17:49:37 -04:00
committed by Dave Syer
parent 04deaeddce
commit 3820fd225b
4 changed files with 46 additions and 9 deletions

View File

@@ -0,0 +1,22 @@
package org.springframework.amqp.helloworld;
import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.core.Queue;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class BrokerConfigurationApplication {
/**
* An example application that only configures the AMQP broker
*/
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("rabbitConfiguration.xml");
AmqpAdmin amqpAdmin = context.getBean(AmqpAdmin.class);
Queue helloWorldQueue = new Queue("hello.world.queue");
amqpAdmin.declareQueue(helloWorldQueue);
}
}

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="connectionFactory" class="org.springframework.amqp.rabbit.connection.SingleConnectionFactory">
<constructor-arg value="localhost"/>
<property name="username" value="guest"/>
<property name="password" value="guest"/>
</bean>
<bean id="amqpAdmin" class="org.springframework.amqp.rabbit.core.RabbitAdmin">
<constructor-arg ref="connectionFactory"/>
</bean>
</beans>