Package org.springframework.amqp.rabbit.core

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


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

    connectionFactory.destroy();
  }

View Full Code Here


    template.convertAndSend(fanoutTest.getName(), "", "message");
    template.convertAndSend(fanoutTest.getName(), queue.getName(), "message");
    Thread.sleep(200);
    // The queue is anonymous so it will be deleted at the end of the test, but it should get the message as long as
    // we use the same connection
    String result = (String) template.receiveAndConvert(queue.getName());
    assertEquals("message", result);
    result = (String) template.receiveAndConvert(queue.getName());
    assertEquals("message", result);
  }
View Full Code Here

    Thread.sleep(200);
    // The queue is anonymous so it will be deleted at the end of the test, but it should get the message as long as
    // we use the same connection
    String result = (String) template.receiveAndConvert(queue.getName());
    assertEquals("message", result);
    result = (String) template.receiveAndConvert(queue.getName());
    assertEquals("message", result);
  }

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

    RabbitTemplate template = new RabbitTemplate(connectionFactory);

    template.convertAndSend(directTest.getName(), queue.getName(), "message");
    Thread.sleep(200);

    String result = (String) template.receiveAndConvert(queue.getName());
    assertEquals("message", result);

    template.convertAndSend(directTest.getName(), "", "message2");
    Thread.sleep(200);
View Full Code Here

    assertEquals("message", result);

    template.convertAndSend(directTest.getName(), "", "message2");
    Thread.sleep(200);

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

    result = (String) template.receiveAndConvert(queue2.getName());
    assertEquals("message2", result);

    template.convertAndSend(directTest.getName(), queue2.getName(), "message2");
View Full Code Here

    template.convertAndSend(directTest.getName(), "", "message2");
    Thread.sleep(200);

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

    result = (String) template.receiveAndConvert(queue2.getName());
    assertEquals("message2", result);

    template.convertAndSend(directTest.getName(), queue2.getName(), "message2");
    Thread.sleep(200);
View Full Code Here

    assertEquals("message2", result);

    template.convertAndSend(directTest.getName(), queue2.getName(), "message2");
    Thread.sleep(200);

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

    template.convertAndSend(directTest.getName(), queue3.getName(), "message2");
    Thread.sleep(200);

    result = (String) template.receiveAndConvert(queue3.getName());
View Full Code Here

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

    template.convertAndSend(directTest.getName(), queue3.getName(), "message2");
    Thread.sleep(200);

    result = (String) template.receiveAndConvert(queue3.getName());
    assertEquals("message2", result);
  }

}
View Full Code Here

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

  }

  @Test
View Full Code Here

    connectionFactory.setVirtualHost("non-existent");
    RabbitTemplate template = new RabbitTemplate(connectionFactory);
    // Wrong vhost is very unfriendly to client - the exception has no clue (just an EOF)
    exception.expect(AmqpIOException.class);
    String result = (String) template.receiveAndConvert("foo");
    assertEquals("message", result);

  }

  @Test
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.