List of usage examples for org.springframework.amqp.rabbit.core RabbitTemplate setAfterReceivePostProcessors
public void setAfterReceivePostProcessors(MessagePostProcessor... afterReceivePostProcessors)
From source file:org.springframework.cloud.stream.binder.rabbit.RabbitBinderTests.java
@Override public Spy spyOn(final String queue) { final RabbitTemplate template = new RabbitTemplate(this.rabbitAvailableRule.getResource()); template.setAfterReceivePostProcessors(new DelegatingDecompressingPostProcessor()); return new Spy() { @Override// ww w. j a va 2s . c o m public Object receive(boolean expectNull) throws Exception { if (expectNull) { Thread.sleep(50); return template.receiveAndConvert(new RabbitConsumerProperties().getPrefix() + queue); } Object bar = null; int n = 0; while (n++ < 100 && bar == null) { bar = template.receiveAndConvert(new RabbitConsumerProperties().getPrefix() + queue); Thread.sleep(100); } assertThat(n).isLessThan(100).withFailMessage("Message did not arrive in RabbitMQ"); return bar; } }; }
From source file:org.springframework.xd.dirt.integration.bus.rabbit.RabbitMessageBusTests.java
@Override public Spy spyOn(final String queue) { final RabbitTemplate template = new RabbitTemplate(this.rabbitAvailableRule.getResource()); template.setAfterReceivePostProcessors(new DelegatingDecompressingPostProcessor()); return new Spy() { @Override// w ww . jav a 2 s .co 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; } }; }