Examples of declareQueue()


Examples of org.springframework.amqp.rabbit.core.RabbitAdmin.declareQueue()

    container.afterPropertiesSet();

    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    for (int i = 0; i < 20; i++) {
      AnonymousQueue anonymousQueue = new AnonymousQueue();
      admin.declareQueue(anonymousQueue);
      container.addQueueNames(anonymousQueue.getName());
      if (!container.isRunning()) {
        container.start();
      }
    }
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitAdmin.declareQueue()

      throws InterruptedException {
    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    // queue doesn't exist during startup - verify we started, create queue and verify recovery
    Thread.sleep(5000);
    assertEquals(messageCount, latch.getCount());
    admin.declareQueue(new Queue("nonexistent"));
    RabbitTemplate template = new RabbitTemplate(connectionFactory);
    for (int i = 0; i < messageCount; i++) {
      template.convertAndSend("nonexistent", "foo" + i);
    }
    assertTrue(latch.await(10, TimeUnit.SECONDS));
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitAdmin.declareQueue()

    admin.deleteQueue("nonexistent");
    Thread.sleep(3000);
    latch = new CountDownLatch(messageCount);
    container.setMessageListener(new MessageListenerAdapter(new VanillaListener(latch)));
    assertEquals(messageCount, latch.getCount());
    admin.declareQueue(new Queue("nonexistent"));
    for (int i = 0; i < messageCount; i++) {
      template.convertAndSend("nonexistent", "foo" + i);
    }
    assertTrue(latch.await(10, TimeUnit.SECONDS));
    assertEquals(1, consumers.size());
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitAdmin.declareQueue()

  public void testSendAndReceiveFromVolatileQueue() throws Exception {

    RabbitTemplate template = new RabbitTemplate(connectionFactory);

    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    Queue queue = admin.declareQueue();
    template.convertAndSend(queue.getName(), "message");
    String result = (String) template.receiveAndConvert(queue.getName());
    assertEquals("message", result);

  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitAdmin.declareQueue()

  public void testSendAndReceiveFromVolatileQueueAfterImplicitRemoval() throws Exception {

    RabbitTemplate template = new RabbitTemplate(connectionFactory);

    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    Queue queue = admin.declareQueue();
    template.convertAndSend(queue.getName(), "message");

    // Force a physical close of the channel
    connectionFactory.destroy();
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitAdmin.declareQueue()

    RabbitTemplate template1 = new RabbitTemplate(connectionFactory);
    RabbitTemplate template2 = new RabbitTemplate(connectionFactory);
    template1.setChannelTransacted(true);

    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    Queue queue = admin.declareQueue();

    template1.convertAndSend(queue.getName(), "message");
    String result = (String) template2.receiveAndConvert(queue.getName());
    assertEquals("message", result);
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitAdmin.declareQueue()

  public void testHardErrorAndReconnect() throws Exception {

    RabbitTemplate template = new RabbitTemplate(connectionFactory);
    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    Queue queue = new Queue("foo");
    admin.declareQueue(queue);
    final String route = queue.getName();

    final CountDownLatch latch = new CountDownLatch(1);
    try {
      template.execute(new ChannelCallback<Object>() {
View Full Code Here

Examples of org.springframework.amqp.rabbit.core.RabbitAdmin.declareQueue()

    CachingConnectionFactory connectionFactory = new CachingConnectionFactory(BrokerTestUtils.getPort());
    connectionFactory.setHost("localhost");
    RabbitTemplate template = new RabbitTemplate(connectionFactory);
    RabbitAdmin rabbitAdmin = new RabbitAdmin(template.getConnectionFactory());
    rabbitAdmin.deleteQueue(queue.getName());
    rabbitAdmin.declareQueue(queue);

    assertEquals(100L, queue.getArguments().get("x-message-ttl"));
    template.convertAndSend(queue.getName(), "message");

    Thread.sleep(200);
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.