Package org.springframework.amqp.rabbit.core

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


  @Test
  public void testStopStartConditionalDeclarations() throws Exception {
    RabbitTemplate template = context.getBean(RabbitTemplate.class);
    this.listenerContainer2.start();
    template.convertAndSend("otherExchange", "otherAnon", "foo");
    assertNotNull(queue.poll(10, TimeUnit.SECONDS));
    this.listenerContainer2.stop();
    this.listenerContainer2.start();
    template.convertAndSend("otherExchange", "otherAnon", "foo");
    assertNotNull(queue.poll(10, TimeUnit.SECONDS));
View Full Code Here


    this.listenerContainer2.start();
    template.convertAndSend("otherExchange", "otherAnon", "foo");
    assertNotNull(queue.poll(10, TimeUnit.SECONDS));
    this.listenerContainer2.stop();
    this.listenerContainer2.start();
    template.convertAndSend("otherExchange", "otherAnon", "foo");
    assertNotNull(queue.poll(10, TimeUnit.SECONDS));
  }

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

  }

  @Test
  public void testRedeclareXExpiresQueue() throws Exception {
    RabbitTemplate template = context.getBean(RabbitTemplate.class);
    template.convertAndSend("xExpires", "foo");
    assertNotNull(queue.poll(10, TimeUnit.SECONDS));
    SimpleMessageListenerContainer listenerContainer = context.getBean("container3",
        SimpleMessageListenerContainer.class);
    listenerContainer.stop();
    RabbitAdmin admin = spy(TestUtils.getPropertyValue(listenerContainer, "rabbitAdmin", RabbitAdmin.class));
View Full Code Here

      Thread.sleep(100);
      n++;
    }
    assertTrue(n < 100);
    listenerContainer.start();
    template.convertAndSend("xExpires", "foo");
    assertNotNull(queue.poll(10, TimeUnit.SECONDS));
    verify(admin, times(1)).initialize(); // should only be called by one of the consumers
  }

  @Test
View Full Code Here

  }

  @Test
  public void testAutoDeclareFalse() throws Exception {
    RabbitTemplate template = context.getBean(RabbitTemplate.class);
    template.convertAndSend("testContainerWithAutoDeleteQueues", "anon2", "foo");
    assertNotNull(queue.poll(10, TimeUnit.SECONDS));
    SimpleMessageListenerContainer listenerContainer = context.getBean("container4",
        SimpleMessageListenerContainer.class);
    listenerContainer.stop();
    RabbitAdmin admin = spy(TestUtils.getPropertyValue(listenerContainer, "rabbitAdmin", RabbitAdmin.class));
View Full Code Here

    transactional = true;

    CountDownLatch latch = new CountDownLatch(1);
    container = createContainer(queue.getName(), new ChannelSenderListener(sendQueue.getName(), latch, false),
        connectionFactory);
    template.convertAndSend(queue.getName(), "foo");

    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);
View Full Code Here

    transactional = true;

    CountDownLatch latch = new CountDownLatch(1);
    container = createContainer(queue.getName(), new ChannelSenderListener(sendQueue.getName(), latch, true),
        connectionFactory);
    template.convertAndSend(queue.getName(), "foo");

    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);
View Full Code Here

    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");
    }

    int timeout = getTimeout();
    logger.debug("Waiting for messages with timeout = " + timeout + " (s)");
    boolean waited = latch.await(timeout, TimeUnit.SECONDS);
View Full Code Here

    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");
    }

    int timeout = getTimeout();
    logger.debug("Waiting for messages with timeout = " + timeout + " (s)");
    boolean waited = latch.await(timeout, TimeUnit.SECONDS);
View Full Code Here

      Thread.sleep(50L);
    }
    assertEquals(concurrentConsumers, container.getActiveConsumerCount());

    for (int i = 0; i < messageCount; i++) {
      template.convertAndSend(queue.getName(), i + "foo");
    }

    int timeout = getTimeout();
    logger.debug("Waiting for messages with timeout = " + timeout + " (s)");
    boolean waited = latch.await(timeout, TimeUnit.SECONDS);
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.