Package org.springframework.amqp.rabbit.connection

Examples of org.springframework.amqp.rabbit.connection.SingleConnectionFactory.destroy()


    container.setChannelTransacted(false);
    container.setTransactionManager(new TestTransactionManager());
    container.afterPropertiesSet();
    assertTrue(TestUtils.getPropertyValue(container, "transactional", Boolean.class));
    container.stop();
    singleConnectionFactory.destroy();
  }

  @Test
  public void testInconsistentTransactionConfiguration() throws Exception {
    final SingleConnectionFactory singleConnectionFactory = new SingleConnectionFactory("localhost");
View Full Code Here


    container.setAcknowledgeMode(AcknowledgeMode.NONE);
    container.setTransactionManager(new TestTransactionManager());
    expectedException.expect(IllegalStateException.class);
    container.afterPropertiesSet();
    container.stop();
    singleConnectionFactory.destroy();
  }

  @Test
  public void testInconsistentAcknowledgeConfiguration() throws Exception {
    final SingleConnectionFactory singleConnectionFactory = new SingleConnectionFactory("localhost");
View Full Code Here

    container.setChannelTransacted(true);
    container.setAcknowledgeMode(AcknowledgeMode.NONE);
    expectedException.expect(IllegalStateException.class);
    container.afterPropertiesSet();
    container.stop();
    singleConnectionFactory.destroy();
  }

  @Test
  public void testDefaultConsumerCount() throws Exception {
    final SingleConnectionFactory singleConnectionFactory = new SingleConnectionFactory("localhost");
View Full Code Here

    container.setQueueNames("foo");
    container.setAutoStartup(false);
    container.afterPropertiesSet();
    assertEquals(1, ReflectionTestUtils.getField(container, "concurrentConsumers"));
    container.stop();
    singleConnectionFactory.destroy();
  }

  @Test
  public void testLazyConsumerCount() throws Exception {
    final SingleConnectionFactory singleConnectionFactory = new SingleConnectionFactory("localhost");
View Full Code Here

      }
    };
    container.start();
    assertEquals(1, ReflectionTestUtils.getField(container, "concurrentConsumers"));
    container.stop();
    singleConnectionFactory.destroy();
  }

  /*
   * txSize = 2; 4 messages; should get 2 acks (#2 and #4)
   */
 
View Full Code Here

    waitForNConsumers(container, 1, 20000); // should stop the extra consumer after 10 seconds idle
    container.setConcurrentConsumers(3);
    waitForNConsumers(container, 3);
    container.stop();
    waitForNConsumers(container, 0);
    singleConnectionFactory.destroy();
  }

  @Test
  public void testAddQueuesAndStartInCycle() throws Exception {
    final SingleConnectionFactory connectionFactory = new SingleConnectionFactory("localhost");
View Full Code Here

    while (n++ < 100 && container.getActiveConsumerCount() != 2) {
      Thread.sleep(100);
    }
    assertEquals(2, container.getActiveConsumerCount());
    container.stop();
    connectionFactory.destroy();
  }


  public void handleMessage(String foo) {
    logger.info(foo);
View Full Code Here

    applicationContext.getBeanFactory().registerSingleton("foo", new Queue("queue"));
    RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory);
    rabbitAdmin.setApplicationContext(applicationContext);
    rabbitAdmin.setAutoStartup(true);
    rabbitAdmin.afterPropertiesSet();
    connectionFactory.destroy();
  }

  @Test
  public void testFailOnFirstUseWithMissingBroker() throws Exception {
    SingleConnectionFactory connectionFactory = new SingleConnectionFactory("foo");
View Full Code Here

    rabbitAdmin.setApplicationContext(applicationContext);
    rabbitAdmin.setAutoStartup(true);
    rabbitAdmin.afterPropertiesSet();
    exception.expect(IllegalArgumentException.class);
    rabbitAdmin.declareQueue();
    connectionFactory.destroy();
  }

  @Test
  public void testProperties() throws Exception {
    SingleConnectionFactory connectionFactory = new SingleConnectionFactory();
View Full Code Here

      assertEquals(1, props.get(RabbitAdmin.QUEUE_CONSUMER_COUNT));
      channel.close();
    }
    finally {
      rabbitAdmin.deleteQueue(queueName);
      connectionFactory.destroy();
    }
  }

  private int messageCount(RabbitAdmin rabbitAdmin, String queueName) {
    Properties props = rabbitAdmin.getQueueProperties(queueName);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.