Package org.springframework.amqp.rabbit.core

Examples of org.springframework.amqp.rabbit.core.RabbitTemplate.receiveAndConvert()


    assertTrue("Timed out waiting for message", waited);

    // Give message time to reach broker (intermittent test failures)!
    Thread.sleep(500L);
    // All messages committed
    byte[] bytes = (byte[]) template.receiveAndConvert(sendQueue.getName());
    assertNotNull(bytes);
    assertEquals("bar", new String(bytes));
    assertEquals(null, template.receiveAndConvert(queue.getName()));

    ((DisposableBean) connectionFactory).destroy();
View Full Code Here


    Thread.sleep(500L);
    // All messages committed
    byte[] bytes = (byte[]) template.receiveAndConvert(sendQueue.getName());
    assertNotNull(bytes);
    assertEquals("bar", new String(bytes));
    assertEquals(null, template.receiveAndConvert(queue.getName()));

    ((DisposableBean) connectionFactory).destroy();

  }
View Full Code Here

    container.stop();
    Thread.sleep(200L);

    // Foo message is redelivered
    assertEquals("foo", template.receiveAndConvert(queue.getName()));
    // Sending of bar message is also rolled back
    assertNull(template.receiveAndConvert(sendQueue.getName()));

    ((DisposableBean) connectionFactory).destroy();
View Full Code Here

    Thread.sleep(200L);

    // Foo message is redelivered
    assertEquals("foo", template.receiveAndConvert(queue.getName()));
    // Sending of bar message is also rolled back
    assertNull(template.receiveAndConvert(sendQueue.getName()));

    ((DisposableBean) connectionFactory).destroy();

  }
View Full Code Here

    int timeout = getTimeout();
    logger.debug("Waiting for messages with timeout = " + timeout + " (s)");
    boolean waited = latch.await(timeout, TimeUnit.SECONDS);
    assertTrue("Timed out waiting for message", waited);

    assertNull(template.receiveAndConvert(queue.getName()));

    ((DisposableBean) connectionFactory1).destroy();
    ((DisposableBean) connectionFactory2).destroy();
  }
View Full Code Here

    int timeout = getTimeout();
    logger.debug("Waiting for messages with timeout = " + timeout + " (s)");
    boolean waited = latch.await(timeout, TimeUnit.SECONDS);
    assertTrue("Timed out waiting for message", waited);

    assertNull(template.receiveAndConvert(queue.getName()));

    ((DisposableBean) connectionFactory1).destroy();
    ((DisposableBean) connectionFactory2).destroy();
  }
View Full Code Here

    int timeout = getTimeout();
    logger.debug("Waiting for messages with timeout = " + timeout + " (s)");
    boolean waited = latch.await(timeout, TimeUnit.SECONDS);
    assertTrue("Timed out waiting for message", waited);

    assertNull(template.receiveAndConvert(queue.getName()));

    assertEquals(concurrentConsumers, container.getActiveConsumerCount());
    container.stop();
    assertEquals(0, container.getActiveConsumerCount());
View Full Code Here

    int timeout = Math.min(4 + messageCount / (4 * concurrentConsumers), 30);
    logger.debug("Waiting for messages with timeout = " + timeout + " (s)");
    boolean waited = latch.await(timeout, TimeUnit.SECONDS);
    assertTrue("Timed out waiting for message", waited);

    assertNull(template.receiveAndConvert(queue.getName()));

    ((DisposableBean) connectionFactory1).destroy();
    ((DisposableBean) connectionFactory2).destroy();

  }
View Full Code Here

    int timeout = getTimeout();
    logger.debug("Waiting for messages with timeout = " + timeout + " (s)");
    boolean waited = latch.await(timeout, TimeUnit.SECONDS);
    assertTrue("Timed out waiting for message", waited);

    assertNull(template.receiveAndConvert(queue.getName()));

    ((DisposableBean) connectionFactory).destroy();

  }
View Full Code Here

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

    connectionFactory.destroy();
  }
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.