Package org.springframework.amqp.rabbit.connection

Examples of org.springframework.amqp.rabbit.connection.ConnectionFactory


  }

  @Test
  public void testListenerRecoversFromBogusDoubleAck() throws Exception {

    ConnectionFactory connectionFactory1 = createConnectionFactory();
    RabbitTemplate template = new RabbitTemplate(connectionFactory1);

    acknowledgeMode = AcknowledgeMode.MANUAL;

    CountDownLatch latch = new CountDownLatch(messageCount);
    ConnectionFactory connectionFactory2 = createConnectionFactory();
    container = createContainer(queue.getName(), new ManualAckListener(latch), connectionFactory2);
    for (int i = 0; i < messageCount; i++) {
      template.convertAndSend(queue.getName(), i + "foo");
    }
View Full Code Here


  }

  @Test
  public void testListenerRecoversFromClosedChannel() throws Exception {

    ConnectionFactory connectionFactory1 = createConnectionFactory();
    RabbitTemplate template = new RabbitTemplate(connectionFactory1);

    CountDownLatch latch = new CountDownLatch(messageCount);
    ConnectionFactory connectionFactory2 = createConnectionFactory();
    container = createContainer(queue.getName(), new AbortChannelListener(latch), connectionFactory2);
    for (int i = 0; i < messageCount; i++) {
      template.convertAndSend(queue.getName(), i + "foo");
    }
View Full Code Here

  }

  @Test
  public void testListenerRecoversFromClosedChannelAndStop() throws Exception {

    ConnectionFactory connectionFactory1 = createConnectionFactory();
    RabbitTemplate template = new RabbitTemplate(connectionFactory1);

    CountDownLatch latch = new CountDownLatch(messageCount);
    ConnectionFactory connectionFactory2 = createConnectionFactory();
    container = createContainer(queue.getName(), new AbortChannelListener(latch), connectionFactory2);
    int n = 0;
    while (n++ < 100 && container.getActiveConsumerCount() != concurrentConsumers) {
      Thread.sleep(50L);
    }
View Full Code Here

  }

  @Test
  public void testListenerRecoversFromClosedConnection() throws Exception {

    ConnectionFactory connectionFactory1 = createConnectionFactory();
    RabbitTemplate template = new RabbitTemplate(connectionFactory1);

    CountDownLatch latch = new CountDownLatch(messageCount);
    ConnectionFactory connectionFactory2 = createConnectionFactory();
    container = createContainer(queue.getName(),
        new CloseConnectionListener((ConnectionProxy) connectionFactory2.createConnection(), latch),
        connectionFactory2);
    for (int i = 0; i < messageCount; i++) {
      template.convertAndSend(queue.getName(), i + "foo");
    }
View Full Code Here

  }

  @Test
  public void testListenerRecoversAndTemplateSharesConnectionFactory() throws Exception {

    ConnectionFactory connectionFactory = createConnectionFactory();
    RabbitTemplate template = new RabbitTemplate(connectionFactory);

    acknowledgeMode = AcknowledgeMode.MANUAL;

    CountDownLatch latch = new CountDownLatch(messageCount);
View Full Code Here

  public void testListenerDoesNotRecoverFromMissingQueue() throws Exception {

    concurrentConsumers = 3;
    CountDownLatch latch = new CountDownLatch(messageCount);

    ConnectionFactory connectionFactory = createConnectionFactory();
    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    admin.deleteQueue("nonexistent");

    try {
      container = createContainer("nonexistent", new VanillaListener(latch), connectionFactory);
View Full Code Here

     * is a good test of that potential bug.
     */
    concurrentConsumers = 1;
    CountDownLatch latch = new CountDownLatch(messageCount);

    ConnectionFactory connectionFactory = createConnectionFactory();
    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    admin.deleteQueue("nonexistent");
    try {
      container = createContainer("nonexistent", new VanillaListener(latch), connectionFactory);
    }
View Full Code Here

  @Test
  public void testSingleListenerDoesRecoverFromMissingQueueWhenNotFatal() throws Exception {
    concurrentConsumers = 1;
    CountDownLatch latch = new CountDownLatch(messageCount);

    ConnectionFactory connectionFactory = createConnectionFactory();
    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    admin.deleteQueue("nonexistent");
    try {
      container = doCreateContainer("nonexistent", new VanillaListener(latch), connectionFactory);
      container.setMissingQueuesFatal(false);
View Full Code Here

  @Test
  public void testSingleListenerDoesRecoverFromMissingQueueWhenNotFatalGlobalProps() throws Exception {
    concurrentConsumers = 1;
    CountDownLatch latch = new CountDownLatch(messageCount);

    ConnectionFactory connectionFactory = createConnectionFactory();
    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    admin.deleteQueue("nonexistent");
    try {
      container = doCreateContainer("nonexistent", new VanillaListener(latch), connectionFactory);
      Properties properties = new Properties();
View Full Code Here

    this.applicationContext = applicationContext;
  }

  @Override
  public ConnectionFactory getConnectionFactory() {
    ConnectionFactory connectionFactory = super.getConnectionFactory();
    if (connectionFactory instanceof AbstractRoutingConnectionFactory) {
      ConnectionFactory targetConnectionFactory = ((AbstractRoutingConnectionFactory) connectionFactory)
          .getTargetConnectionFactory(this.queueNames.toString().replaceAll(" ", ""));
      if (targetConnectionFactory != null) {
        return targetConnectionFactory;
      }
    }
View Full Code Here

TOP

Related Classes of org.springframework.amqp.rabbit.connection.ConnectionFactory

Copyright © 2018 www.massapicom. 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.