use of com.meltwater.rxrabbit.ConsumerFactory in project rxrabbit by meltwater.
the class ExampleAppsTest method consumeDocumentsAndGetIds.
private Set<String> consumeDocumentsAndGetIds(int nrToPublish) throws InterruptedException {
final SortedSet<String> out = Collections.synchronizedSortedSet(new TreeSet<String>());
ConsumerFactory consumerFactory = new DefaultConsumerFactory(channelFactory, new ConsumerSettings());
consumerFactory.createConsumer(prop.getProperty("out.queue")).doOnNext(message -> message.acknowledger.ack()).doOnNext(message -> out.add(message.basicProperties.getMessageId())).take(nrToPublish).timeout(100, TimeUnit.SECONDS).toBlocking().last();
return out;
}
Aggregations