Examples of receiveAndConvert()


Examples of org.springframework.amqp.core.AmqpTemplate.receiveAndConvert()

public class Consumer {
 
  public static void main(String[] args) {
    ApplicationContext context = new AnnotationConfigApplicationContext(HelloWorldConfiguration.class);
    AmqpTemplate amqpTemplate = context.getBean(AmqpTemplate.class);
    System.out.println("Received: " + amqpTemplate.receiveAndConvert());
  }

}
View Full Code Here

Examples of org.springframework.amqp.core.AmqpTemplate.receiveAndConvert()

    }

    @Test
    public void testNoItemType() {
        final AmqpTemplate amqpTemplate = mock(AmqpTemplate.class);
        when(amqpTemplate.receiveAndConvert()).thenReturn("foo");

        final AmqpItemReader<String> amqpItemReader = new AmqpItemReader<String>(amqpTemplate);
        assertEquals("foo", amqpItemReader.read());
    }
View Full Code Here

Examples of org.springframework.amqp.core.AmqpTemplate.receiveAndConvert()

    }

    @Test
    public void testNonMessageItemType() {
        final AmqpTemplate amqpTemplate = mock(AmqpTemplate.class);
        when(amqpTemplate.receiveAndConvert()).thenReturn("foo");

        final AmqpItemReader<String> amqpItemReader = new AmqpItemReader<String>(amqpTemplate);
        amqpItemReader.setItemType(String.class);

        assertEquals("foo", amqpItemReader.read());
View Full Code Here

Examples of org.springframework.amqp.core.AmqpTemplate.receiveAndConvert()

    @Test
    public void testTypeMismatch() {
        final AmqpTemplate amqpTemplate = mock(AmqpTemplate.class);

        when(amqpTemplate.receiveAndConvert()).thenReturn("foo");

        final AmqpItemReader<Integer> amqpItemReader = new AmqpItemReader<Integer>(amqpTemplate);
        amqpItemReader.setItemType(Integer.class);

        try {
View Full Code Here

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

    template.convertAndSend("Hello, Rabbit!");
    template.convertAndSend("Hello, AMQP!");

    int count = 0;
    while (true) {
      String message = (String) template.receiveAndConvert();
      if (message == null) {
        break;
      }
      else {
        count++;
View Full Code Here

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

  }

  @Override
  protected void verifyOnDemandQueues(MessageChannel y3, MessageChannel z3) {
    RabbitTemplate template = new RabbitTemplate(rabbitAvailableRule.getResource());
    Object y = template.receiveAndConvert("xdbus.queue:y");
    assertNotNull(y);
    assertEquals("y", y);
    Object z = template.receiveAndConvert("xdbus.queue:z");
    assertNotNull(z);
    assertEquals("z", z);
View Full Code Here

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

    RabbitTemplate template = new RabbitTemplate(this.rabbitAvailableRule.getResource());
    template.convertAndSend("", "xdbustest.dlqtest", "foo");

    int n = 0;
    while (n++ < 100) {
      Object deadLetter = template.receiveAndConvert("xdbustest.dlqtest.dlq");
      if (deadLetter != null) {
        assertEquals("foo", deadLetter);
        break;
      }
      Thread.sleep(100);
View Full Code Here

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

  protected void verifyOnDemandQueues(MessageChannel y3, MessageChannel z3) {
    RabbitTemplate template = new RabbitTemplate(rabbitAvailableRule.getResource());
    Object y = template.receiveAndConvert("xdbus.queue:y");
    assertNotNull(y);
    assertEquals("y", y);
    Object z = template.receiveAndConvert("xdbus.queue:z");
    assertNotNull(z);
    assertEquals("z", z);
  }

  @Override
View Full Code Here

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

      @Override
      public Object receive(boolean expectNull) throws Exception {
        if (expectNull) {
          Thread.sleep(50);
          return template.receiveAndConvert("xdbus." + queue);
        }
        Object bar = null;
        int n = 0;
        while (n++ < 100 && bar == null) {
          bar = template.receiveAndConvert("xdbus." + queue);
View Full Code Here

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

          return template.receiveAndConvert("xdbus." + queue);
        }
        Object bar = null;
        int n = 0;
        while (n++ < 100 && bar == null) {
          bar = template.receiveAndConvert("xdbus." + queue);
          Thread.sleep(100);
        }
        assertTrue("Message did not arrive in RabbitMQ", n < 100);
        return bar;
      }
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.