Package org.springframework.amqp.rabbit.connection

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


      }
    }

    Assert.assertEquals("Did not send/receive the messages correctly", 6, count);

    connectionFactory.destroy();

    stopTunnelServer();
    removeService(VCAP_RABBIT_SERVICE);
    logger.info("Time elapsed: " + (System.currentTimeMillis() - start) / 1000.0d + " sec");
  }
View Full Code Here


    // TODO: make this into a proper assertion. An exception can be thrown here by the Rabbit client and printed to
    // stderr without being rethrown (so hard to make a test fail).
    blockingQueueConsumer.stop();
    assertNull(template.receiveAndConvert(queue.getName()));
    connectionFactory.destroy();

  }

}
View Full Code Here

      if (assumeOnline) {
        Assume.assumeNoException(e);
      }
    }
    finally {
      connectionFactory.destroy();
    }

    return super.apply(base, description);

  }
View Full Code Here

      assertEquals(0, container.getActiveConsumerCount());
    }
    assertNull(template.receiveAndConvert(queue1.getName()));
    assertNull(template.receiveAndConvert(queue2.getName()));

    connectionFactory.destroy();
  }


  private interface ContainerConfigurer {
    void configure(SimpleMessageListenerContainer container);
View Full Code Here

    container.setMessageListener(new MessageListenerAdapter());
    container.afterPropertiesSet();
    container.start();

    try {
      connectionFactory.destroy();

      assertTrue(latch.await(10, TimeUnit.SECONDS));
      Mockito.verify(log).debug(
          Mockito.contains("Consumer received Shutdown Signal, processing stopped"));
      Mockito.verify(log, Mockito.never()).warn(Mockito.anyString(), Mockito.any(Throwable.class));
View Full Code Here

    context.getBeanFactory().registerSingleton("foo", queue);
    context.refresh();
    admin.setApplicationContext(context);
    admin.afterPropertiesSet();
    ccf.createConnection().close();
    ccf.destroy();

    assertEquals("Admin should not have created a channel", 0,  mockChannels.size());
  }

  @Test
View Full Code Here

    try {
      new RabbitAdmin(connectionFactory2).declareQueue(queue);
    } finally {
      // Need to release the connection so the exclusive queue is deleted
      connectionFactory1.destroy();
      connectionFactory2.destroy();
    }
  }

  @Test
  public void testDoubleDeclarationOfAutodeleteQueue() throws Exception {
View Full Code Here

    connectionFactory2.setPort(BrokerTestUtils.getPort());
    Queue queue = new Queue("test.queue", false, false, true);
    new RabbitAdmin(connectionFactory1).declareQueue(queue);
    new RabbitAdmin(connectionFactory2).declareQueue(queue);
    connectionFactory1.destroy();
    connectionFactory2.destroy();
  }

  @Test
  public void testQueueWithAutoDelete() throws Exception {
View Full Code Here

    assertNotNull("Reply is expected", reply);
    assertEquals(new String(message.getBody()), new String(reply.getBody()));
    // Message was consumed so nothing left on queue
    reply = template.receive();
    assertEquals(null, reply);
    cachingConnectionFactory.destroy();
  }

  @Test
  public void testAtomicSendAndReceiveExternalExecutor() throws Exception {
    final CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
View Full Code Here

    // Message was consumed so nothing left on queue
    reply = template.receive();
    assertEquals(null, reply);

    assertTrue(execConfiguredOk.get());
    connectionFactory.destroy();
  }

  @Test
  public void testAtomicSendAndReceiveWithRoutingKey() throws Exception {
    final CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
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.