Example usage for org.springframework.amqp.rabbit.core RabbitAdmin declareQueue

List of usage examples for org.springframework.amqp.rabbit.core RabbitAdmin declareQueue

Introduction

In this page you can find the example usage for org.springframework.amqp.rabbit.core RabbitAdmin declareQueue.

Prototype

@Override
@ManagedOperation(description = "Declare a queue with a broker-generated name (this operation is not available remotely)")
@Nullable
public Queue declareQueue() 

Source Link

Document

Declares a server-named exclusive, autodelete, non-durable queue.

Usage

From source file:org.springframework.amqp.rabbit.core.RabbitAdminTests.java

@Test
public void testFailOnFirstUseWithMissingBroker() throws Exception {
    SingleConnectionFactory connectionFactory = new SingleConnectionFactory("localhost");
    connectionFactory.setPort(434343);//  www.j  av a  2  s . co m
    GenericApplicationContext applicationContext = new GenericApplicationContext();
    applicationContext.getBeanFactory().registerSingleton("foo", new Queue("queue"));
    RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory);
    rabbitAdmin.setApplicationContext(applicationContext);
    rabbitAdmin.setAutoStartup(true);
    rabbitAdmin.afterPropertiesSet();
    exception.expect(IllegalArgumentException.class);
    rabbitAdmin.declareQueue();
    connectionFactory.destroy();
}