Search in sources :

Example 1 with ConsumerFactory

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;
}
Also used : ConsumerSettings(com.meltwater.rxrabbit.ConsumerSettings) ConsumerFactory(com.meltwater.rxrabbit.ConsumerFactory) AfterClass(org.junit.AfterClass) Properties(java.util.Properties) Exchange(com.meltwater.rxrabbit.Exchange) SortedSet(java.util.SortedSet) ConsumerSettings(com.meltwater.rxrabbit.ConsumerSettings) DockerContainers(com.meltwater.rxrabbit.docker.DockerContainers) Set(java.util.Set) Test(org.junit.Test) IOException(java.io.IOException) ConnectionSettings(com.meltwater.rxrabbit.ConnectionSettings) TreeSet(java.util.TreeSet) Logger(com.meltwater.rxrabbit.util.Logger) TimeUnit(java.util.concurrent.TimeUnit) Assert.assertThat(org.junit.Assert.assertThat) DefaultConsumerFactory(com.meltwater.rxrabbit.DefaultConsumerFactory) BrokerAddresses(com.meltwater.rxrabbit.BrokerAddresses) DefaultChannelFactory(com.meltwater.rxrabbit.impl.DefaultChannelFactory) After(org.junit.After) Is.is(org.hamcrest.core.Is.is) RabbitTestUtils(com.meltwater.rxrabbit.RabbitTestUtils) Collections(java.util.Collections) Before(org.junit.Before) ConsumerFactory(com.meltwater.rxrabbit.ConsumerFactory) DefaultConsumerFactory(com.meltwater.rxrabbit.DefaultConsumerFactory) DefaultConsumerFactory(com.meltwater.rxrabbit.DefaultConsumerFactory)

Aggregations

BrokerAddresses (com.meltwater.rxrabbit.BrokerAddresses)1 ConnectionSettings (com.meltwater.rxrabbit.ConnectionSettings)1 ConsumerFactory (com.meltwater.rxrabbit.ConsumerFactory)1 ConsumerSettings (com.meltwater.rxrabbit.ConsumerSettings)1 DefaultConsumerFactory (com.meltwater.rxrabbit.DefaultConsumerFactory)1 Exchange (com.meltwater.rxrabbit.Exchange)1 RabbitTestUtils (com.meltwater.rxrabbit.RabbitTestUtils)1 DockerContainers (com.meltwater.rxrabbit.docker.DockerContainers)1 DefaultChannelFactory (com.meltwater.rxrabbit.impl.DefaultChannelFactory)1 Logger (com.meltwater.rxrabbit.util.Logger)1 IOException (java.io.IOException)1 Collections (java.util.Collections)1 Properties (java.util.Properties)1 Set (java.util.Set)1 SortedSet (java.util.SortedSet)1 TreeSet (java.util.TreeSet)1 TimeUnit (java.util.concurrent.TimeUnit)1 Is.is (org.hamcrest.core.Is.is)1 After (org.junit.After)1 AfterClass (org.junit.AfterClass)1