add declareQueue to AmqpAdmin interface
additiona docs XML example to configure AmqpAdmin implementations
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
16
helloworld/src/main/resources/rabbitConfiguration.xml
Normal file
16
helloworld/src/main/resources/rabbitConfiguration.xml
Normal 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>
|
||||
Reference in New Issue
Block a user