io.vertx.core.impl.ConcurrentHashSet Java Examples

The following examples show how to use io.vertx.core.impl.ConcurrentHashSet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AsynchronousPayloadProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulProcessingOfPayload() throws InterruptedException {
    addBeanClass(SuccessfulPayloadProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #2
Source File: MessageProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulProcessingOfMesssage() throws InterruptedException {
    addBeanClass(SuccessfulMessageProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #3
Source File: MessageProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulProcessingOfPayload() throws InterruptedException {
    addBeanClass(SuccessfulPayloadToMessageProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #4
Source File: MessageProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingProcessingOfMessage() throws InterruptedException {
    addBeanClass(FailingMessageProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    List<Throwable> throwables = run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 9);
    assertThat(acked).hasSize(9);
    assertThat(nacked).hasSize(1);
    assertThat(throwables).hasSize(1)
            .allSatisfy(t -> assertThat(t).isInstanceOf(IllegalArgumentException.class).hasMessageContaining("b"));
}
 
Example #5
Source File: MessageProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingProcessingOfPayload() throws InterruptedException {
    addBeanClass(FailingPayloadToMessageProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 9);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #6
Source File: MessageProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulBlockingProcessingOfMessage() throws InterruptedException {
    addBeanClass(SuccessfulBlockingMessageProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #7
Source File: MessageProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulBlockingProcessingOfPayload() throws InterruptedException {
    addBeanClass(SuccessfulBlockingPayloadToMessageProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #8
Source File: MessageProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingBlockingProcessingOfMessage() throws InterruptedException {
    addBeanClass(FailingBlockingMessageProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    List<Throwable> throwables = run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 9);
    assertThat(acked).hasSize(9);
    assertThat(nacked).hasSize(1);
    assertThat(throwables).hasSize(1)
            .allSatisfy(t -> assertThat(t).isInstanceOf(IllegalArgumentException.class).hasMessageContaining("b"));
}
 
Example #9
Source File: MessageProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingBlockingProcessingOfPayload() throws InterruptedException {
    addBeanClass(FailingBlockingPayloadToMessageProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 9);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #10
Source File: SynchronousPayloadProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulProcessingOfPayload() throws InterruptedException {
    addBeanClass(SuccessfulPayloadProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #11
Source File: AsynchronousPayloadProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulProcessingOfPayloadUni() throws InterruptedException {
    addBeanClass(SuccessfulPayloadProcessorUni.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #12
Source File: AsynchronousPayloadProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingProcessingOfPayload() throws InterruptedException {
    addBeanClass(FailingPayloadProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    List<Throwable> throwables = run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 7);
    assertThat(acked).hasSize(8);
    assertThat(nacked).hasSize(2);
    assertThat(throwables).hasSize(2);
}
 
Example #13
Source File: AsynchronousPayloadProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingProcessingOfPayloadUni() throws InterruptedException {
    addBeanClass(FailingPayloadProcessorUni.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    List<Throwable> throwables = run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 7);
    assertThat(acked).hasSize(8);
    assertThat(nacked).hasSize(2);
    assertThat(throwables).hasSize(2);
}
 
Example #14
Source File: AsynchronousMessageProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulProcessingOfMessage() throws InterruptedException {
    addBeanClass(SuccessfulMessageProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #15
Source File: AsynchronousMessageProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulProcessingOfMessageUni() throws InterruptedException {
    addBeanClass(SuccessfulMessageProcessorUni.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #16
Source File: AsynchronousMessageProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingProcessingOfMessage() throws InterruptedException {
    addBeanClass(FailingMessageProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    List<Throwable> throwables = run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 8);
    assertThat(acked).hasSize(9);
    assertThat(nacked).hasSize(1);
    assertThat(throwables).hasSize(1);
}
 
Example #17
Source File: AsynchronousMessageProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingProcessingOfMessageUni() throws InterruptedException {
    addBeanClass(FailingMessageProcessorUni.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    List<Throwable> throwables = run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 8);
    assertThat(acked).hasSize(9);
    assertThat(nacked).hasSize(1);
    assertThat(throwables).hasSize(1);
}
 
Example #18
Source File: SubscriberAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingAsyncConsumptionOfMessage() throws InterruptedException {
    addBeanClass(EmitterBean.class);
    addBeanClass(FailingMessageAsyncConsumer.class);
    initialize();

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    Emitter<String> emitter = container.getBeanManager().createInstance().select(EmitterBean.class).get().emitter();
    FailingMessageAsyncConsumer consumer = container.getBeanManager().createInstance().select(
            FailingMessageAsyncConsumer.class).get();
    List<Throwable> throwables = run(acked, nacked, emitter);

    await().until(() -> consumer.list().size() == 10);
    assertThat(acked).hasSize(8);
    assertThat(nacked).hasSize(2);
    assertThat(throwables).hasSize(2)
            .anySatisfy(t -> assertThat(t).isInstanceOf(IllegalArgumentException.class)
                    .hasMessageContaining("2"))
            .anySatisfy(t -> assertThat(t)
                    .isInstanceOf(ProcessingException.class)
                    .hasCauseInstanceOf(InvocationTargetException.class).hasStackTraceContaining("8"));
}
 
Example #19
Source File: SynchronousPayloadProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulProcessingOfMessage() throws InterruptedException {
    addBeanClass(SuccessfulMessageToPayloadProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #20
Source File: SynchronousPayloadProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingProcessingOfPayload() throws InterruptedException {
    addBeanClass(FailingPayloadProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    List<Throwable> throwables = run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 8);
    assertThat(acked).hasSize(9);
    assertThat(nacked).hasSize(1);
    assertThat(throwables).hasSize(1).allSatisfy(t -> assertThat(t).isInstanceOf(ProcessingException.class)
            .hasCauseInstanceOf(InvocationTargetException.class).hasStackTraceContaining("b"));
}
 
Example #21
Source File: SynchronousPayloadProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingProcessingOfMessage() throws InterruptedException {
    addBeanClass(FailingMessageToPayloadProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    List<Throwable> throwables = run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 8);
    assertThat(acked).hasSize(9);
    assertThat(nacked).hasSize(1);
    assertThat(throwables).hasSize(1).allSatisfy(t -> assertThat(t).isInstanceOf(ProcessingException.class)
            .hasCauseInstanceOf(InvocationTargetException.class).hasStackTraceContaining("b"));
}
 
Example #22
Source File: SynchronousPayloadProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulBlockingProcessingOfPayload() throws InterruptedException {
    addBeanClass(SuccessfulBlockingPayloadProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #23
Source File: SynchronousPayloadProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulBlockingProcessingOfMessage() throws InterruptedException {
    addBeanClass(SuccessfulBlockingMessageToPayloadProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #24
Source File: SynchronousPayloadProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingBlockingProcessingOfPayload() throws InterruptedException {
    addBeanClass(FailingBlockingPayloadProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    List<Throwable> throwables = run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 8);
    assertThat(acked).hasSize(9);
    assertThat(nacked).hasSize(1);
    assertThat(throwables).hasSize(1).allSatisfy(t -> assertThat(t).isInstanceOf(ProcessingException.class)
            .hasCauseInstanceOf(InvocationTargetException.class).hasStackTraceContaining("b"));
}
 
Example #25
Source File: SynchronousPayloadProcessorAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingBlockingProcessingOfMessage() throws InterruptedException {
    addBeanClass(FailingBlockingMessageToPayloadProcessor.class);
    initialize();
    Emitter<String> emitter = get(EmitterBean.class).emitter();
    Sink sink = get(Sink.class);

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    List<Throwable> throwables = run(acked, nacked, emitter);

    await().until(() -> sink.list().size() == 8);
    assertThat(acked).hasSize(9);
    assertThat(nacked).hasSize(1);
    assertThat(throwables).hasSize(1).allSatisfy(t -> assertThat(t).isInstanceOf(ProcessingException.class)
            .hasCauseInstanceOf(InvocationTargetException.class).hasStackTraceContaining("b"));
}
 
Example #26
Source File: SubscriberAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulConsumptionOfPayload() throws InterruptedException {
    addBeanClass(EmitterBean.class);
    addBeanClass(SuccessfulPayloadConsumer.class);
    initialize();

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    Emitter<String> emitter = container.getBeanManager().createInstance().select(EmitterBean.class).get().emitter();
    SuccessfulPayloadConsumer consumer = container.getBeanManager().createInstance().select(
            SuccessfulPayloadConsumer.class).get();
    run(acked, nacked, emitter);

    await().until(() -> consumer.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #27
Source File: SubscriberAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingConsumptionOfPayload() throws InterruptedException {
    addBeanClass(EmitterBean.class);
    addBeanClass(FailingPayloadConsumer.class);
    initialize();

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    Emitter<String> emitter = container.getBeanManager().createInstance().select(EmitterBean.class).get().emitter();
    FailingPayloadConsumer consumer = container.getBeanManager().createInstance().select(
            FailingPayloadConsumer.class).get();
    List<Throwable> reasons = run(acked, nacked, emitter);

    await().until(() -> consumer.list().size() == 8);
    assertThat(acked).hasSize(8);
    assertThat(nacked).hasSize(2);
    assertThat(reasons).hasSize(2);
}
 
Example #28
Source File: SubscriberAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulBlockingConsumptionOfPayload() throws InterruptedException {
    addBeanClass(EmitterBean.class);
    addBeanClass(BlockingSuccessfulPayloadConsumer.class);
    initialize();

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    Emitter<String> emitter = container.getBeanManager().createInstance().select(EmitterBean.class).get().emitter();
    BlockingSuccessfulPayloadConsumer consumer = container.getBeanManager().createInstance().select(
            BlockingSuccessfulPayloadConsumer.class).get();
    run(acked, nacked, emitter);

    await().until(() -> consumer.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}
 
Example #29
Source File: SubscriberAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreNackedAfterFailingBlockingConsumptionOfPayload() throws InterruptedException {
    addBeanClass(EmitterBean.class);
    addBeanClass(BlockingFailingPayloadConsumer.class);
    initialize();

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    Emitter<String> emitter = container.getBeanManager().createInstance().select(EmitterBean.class).get().emitter();
    BlockingFailingPayloadConsumer consumer = container.getBeanManager().createInstance().select(
            BlockingFailingPayloadConsumer.class).get();
    List<Throwable> reasons = run(acked, nacked, emitter);

    await().until(() -> consumer.list().size() == 8);
    assertThat(acked).hasSize(8);
    assertThat(nacked).hasSize(2);
    assertThat(reasons).hasSize(2);
}
 
Example #30
Source File: SubscriberAckTest.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@Test
public void testThatMessagesAreAckedAfterSuccessfulAsyncConsumptionOfPayload() throws InterruptedException {
    addBeanClass(EmitterBean.class);
    addBeanClass(SuccessfulPayloadAsyncConsumer.class);
    initialize();

    Set<String> acked = new ConcurrentHashSet<>();
    Set<String> nacked = new ConcurrentHashSet<>();

    Emitter<String> emitter = container.getBeanManager().createInstance().select(EmitterBean.class).get().emitter();
    SuccessfulPayloadAsyncConsumer consumer = container.getBeanManager().createInstance().select(
            SuccessfulPayloadAsyncConsumer.class).get();
    run(acked, nacked, emitter);

    await().until(() -> consumer.list().size() == 10);
    assertThat(acked).hasSize(10);
    assertThat(nacked).hasSize(0);
}