List of usage examples for org.springframework.amqp.rabbit.core RabbitTemplate receiveAndConvert
@Override @Nullable public <T> T receiveAndConvert(ParameterizedTypeReference<T> type) throws AmqpException
From source file:org.springframework.xd.dirt.integration.rabbit.RabbitMessageBusTests.java
@Override public Spy spyOn(final String queue) { final RabbitTemplate template = new RabbitTemplate(this.rabbitAvailableRule.getResource()); template.setAfterReceivePostProcessor(new DelegatingDecompressingPostProcessor()); return new Spy() { @Override/* ww w . ja v a 2s . c o m*/ 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); Thread.sleep(100); } assertTrue("Message did not arrive in RabbitMQ", n < 100); return bar; } }; }