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

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

Introduction

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

Prototype

public void setAutoStartup(boolean autoStartup) 

Source Link

Usage

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

@Test
public void testNoFailOnStartupWithMissingBroker() throws Exception {
    SingleConnectionFactory connectionFactory = new SingleConnectionFactory("foo");
    connectionFactory.setPort(434343);//www  .  j  a  v a 2  s .  c o  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();
    connectionFactory.destroy();
}

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

@Test
public void testFailOnFirstUseWithMissingBroker() throws Exception {
    SingleConnectionFactory connectionFactory = new SingleConnectionFactory("localhost");
    connectionFactory.setPort(434343);/*from  w w  w . j  a v a2  s  .c  o  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();
}