Search in sources :

Example 6 with Consumer

use of com.rabbitmq.stream.Consumer in project rabbitmq-stream-java-client by rabbitmq.

the class SuperStreamConsumerTest method manualOffsetTrackingShouldStoreOnAllPartitions.

@Test
void manualOffsetTrackingShouldStoreOnAllPartitions() throws Exception {
    declareSuperStreamTopology(connection, superStream, partitionCount);
    Client client = cf.get();
    List<String> partitions = client.partitions(superStream);
    int messageCount = 10000 * partitionCount;
    publishToPartitions(cf, partitions, messageCount);
    ConcurrentMap<String, AtomicInteger> messagesReceived = new ConcurrentHashMap<>(partitionCount);
    ConcurrentMap<String, Long> lastOffsets = new ConcurrentHashMap<>(partitionCount);
    partitions.forEach(p -> {
        messagesReceived.put(p, new AtomicInteger(0));
    });
    CountDownLatch consumeLatch = new CountDownLatch(messageCount);
    String consumerName = "my-app";
    AtomicInteger totalCount = new AtomicInteger();
    Consumer consumer = environment.consumerBuilder().superStream(superStream).offset(OffsetSpecification.first()).name(consumerName).manualTrackingStrategy().builder().messageHandler((context, message) -> {
        String partition = new String(message.getBodyAsBinary());
        messagesReceived.get(partition).incrementAndGet();
        lastOffsets.put(partition, context.offset());
        totalCount.incrementAndGet();
        if (totalCount.get() % 50 == 0) {
            context.storeOffset();
        }
        consumeLatch.countDown();
    }).build();
    latchAssert(consumeLatch).completes();
    assertThat(messagesReceived).hasSize(partitionCount);
    partitions.forEach(p -> {
        assertThat(messagesReceived).containsKey(p);
        assertThat(messagesReceived.get(p).get()).isEqualTo(messageCount / partitionCount);
    });
    // checking stored offsets are big enough
    // offset near the end (the message count per partition minus a few messages)
    long almostLastOffset = messageCount / partitionCount - messageCount / (partitionCount * 10);
    partitions.forEach(p -> assertThat(client.queryOffset(consumerName, p).getOffset()).isGreaterThan(almostLastOffset));
    consumer.close();
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) TestUtils.latchAssert(com.rabbitmq.stream.impl.TestUtils.latchAssert) Connection(com.rabbitmq.client.Connection) TestUtils.b(com.rabbitmq.stream.impl.TestUtils.b) ClientParameters(com.rabbitmq.stream.impl.Client.ClientParameters) ConcurrentMap(java.util.concurrent.ConcurrentMap) TestUtils.deleteSuperStreamTopology(com.rabbitmq.stream.impl.TestUtils.deleteSuperStreamTopology) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) TestUtils.declareSuperStreamTopology(com.rabbitmq.stream.impl.TestUtils.declareSuperStreamTopology) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) EventLoopGroup(io.netty.channel.EventLoopGroup) ConnectionFactory(com.rabbitmq.client.ConnectionFactory) Environment(com.rabbitmq.stream.Environment) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Consumer(com.rabbitmq.stream.Consumer) EnvironmentBuilder(com.rabbitmq.stream.EnvironmentBuilder) StandardCharsets(java.nio.charset.StandardCharsets) TestInfo(org.junit.jupiter.api.TestInfo) Test(org.junit.jupiter.api.Test) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) Collections(java.util.Collections) OffsetSpecification(com.rabbitmq.stream.OffsetSpecification) TestUtils.localhost(com.rabbitmq.stream.impl.TestUtils.localhost) CountDownLatch(java.util.concurrent.CountDownLatch) Consumer(com.rabbitmq.stream.Consumer) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Test(org.junit.jupiter.api.Test)

Example 7 with Consumer

use of com.rabbitmq.stream.Consumer in project rabbitmq-stream-java-client by rabbitmq.

the class StreamConsumerTest method manualTrackingConsumerShouldRestartWhereItLeftOff.

@Test
void manualTrackingConsumerShouldRestartWhereItLeftOff() throws Exception {
    Producer producer = environment.producerBuilder().stream(stream).build();
    int messageCountFirstWave = 10_000;
    int messageCountSecondWave = 5_000;
    int messageCount = messageCountFirstWave + messageCountSecondWave;
    CountDownLatch latchConfirmFirstWave = new CountDownLatch(messageCountFirstWave);
    CountDownLatch latchConfirmSecondWave = new CountDownLatch(messageCount);
    ConfirmationHandler confirmationHandler = confirmationStatus -> {
        latchConfirmFirstWave.countDown();
        latchConfirmSecondWave.countDown();
    };
    AtomicLong messageIdSequence = new AtomicLong();
    java.util.function.Consumer<Integer> messageSending = messageCountToSend -> {
        IntStream.range(0, messageCountToSend).forEach(i -> producer.send(producer.messageBuilder().addData("".getBytes()).properties().messageId(messageIdSequence.getAndIncrement()).messageBuilder().build(), confirmationHandler));
    };
    messageSending.accept(messageCountFirstWave);
    assertThat(latchAssert(latchConfirmFirstWave)).completes();
    int storeEvery = 100;
    AtomicInteger consumedMessageCount = new AtomicInteger();
    AtomicReference<Consumer> consumerReference = new AtomicReference<>();
    AtomicLong lastStoredOffset = new AtomicLong(0);
    AtomicLong lastProcessedMessage = new AtomicLong(0);
    AtomicInteger storeCount = new AtomicInteger(0);
    Consumer consumer = environment.consumerBuilder().stream(stream).offset(OffsetSpecification.first()).name("application-1").manualTrackingStrategy().checkInterval(Duration.ZERO).builder().messageHandler((context, message) -> {
        consumedMessageCount.incrementAndGet();
        lastProcessedMessage.set(message.getProperties().getMessageIdAsLong());
        if (consumedMessageCount.get() % storeEvery == 0) {
            context.storeOffset();
            lastStoredOffset.set(context.offset());
            storeCount.incrementAndGet();
        }
    }).build();
    ConsumerInfo consumerInfo = MonitoringTestUtils.extract(consumer);
    assertThat(consumerInfo.getId()).isGreaterThanOrEqualTo(0);
    assertThat(consumerInfo.getStream()).isEqualTo(stream);
    assertThat(consumerInfo.getSubscriptionClient()).contains(" -> localhost:5552");
    assertThat(consumerInfo.getTrackingClient()).contains(" -> localhost:5552");
    consumerReference.set(consumer);
    waitAtMost(10, () -> consumedMessageCount.get() == messageCountFirstWave);
    assertThat(lastStoredOffset.get()).isPositive();
    consumer.close();
    messageSending.accept(messageCountSecondWave);
    assertThat(latchAssert(latchConfirmSecondWave)).completes();
    AtomicLong firstOffset = new AtomicLong(0);
    consumer = environment.consumerBuilder().stream(stream).name("application-1").manualTrackingStrategy().checkInterval(Duration.ZERO).builder().messageHandler((context, message) -> {
        firstOffset.compareAndSet(0, context.offset());
        if (message.getProperties().getMessageIdAsLong() > lastProcessedMessage.get()) {
            consumedMessageCount.incrementAndGet();
        }
    }).build();
    waitAtMost(3, () -> consumedMessageCount.get() == messageCount, () -> "Expected " + consumedMessageCount.get() + " to reach " + messageCount);
    // there will be the tracking records after the first wave of messages,
    // messages offset won't be contiguous, so it's not an exact match
    assertThat(firstOffset.get()).isGreaterThanOrEqualTo(lastStoredOffset.get());
    consumer.close();
}
Also used : IntStream(java.util.stream.IntStream) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) StreamDoesNotExistException(com.rabbitmq.stream.StreamDoesNotExistException) IntConsumer(java.util.function.IntConsumer) TestUtils.latchAssert(com.rabbitmq.stream.impl.TestUtils.latchAssert) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) UnaryOperator(java.util.function.UnaryOperator) AtomicReference(java.util.concurrent.atomic.AtomicReference) TestUtils.b(com.rabbitmq.stream.impl.TestUtils.b) TestUtils.streamName(com.rabbitmq.stream.impl.TestUtils.streamName) ConfirmationHandler(com.rabbitmq.stream.ConfirmationHandler) DisabledIfRabbitMqCtlNotSet(com.rabbitmq.stream.impl.TestUtils.DisabledIfRabbitMqCtlNotSet) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ConsumerBuilder(com.rabbitmq.stream.ConsumerBuilder) Duration(java.time.Duration) MethodSource(org.junit.jupiter.params.provider.MethodSource) Host(com.rabbitmq.stream.Host) TestUtils.waitAtMost(com.rabbitmq.stream.impl.TestUtils.waitAtMost) EventLoopGroup(io.netty.channel.EventLoopGroup) Environment(com.rabbitmq.stream.Environment) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) UUID(java.util.UUID) Consumer(com.rabbitmq.stream.Consumer) Producer(com.rabbitmq.stream.Producer) String.format(java.lang.String.format) EnvironmentBuilder(com.rabbitmq.stream.EnvironmentBuilder) ConsumerInfo(com.rabbitmq.stream.impl.MonitoringTestUtils.ConsumerInfo) TestInfo(org.junit.jupiter.api.TestInfo) BackOffDelayPolicy(com.rabbitmq.stream.BackOffDelayPolicy) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) CountDownLatch(java.util.concurrent.CountDownLatch) AtomicLong(java.util.concurrent.atomic.AtomicLong) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Stream(java.util.stream.Stream) Collections(java.util.Collections) OffsetSpecification(com.rabbitmq.stream.OffsetSpecification) TestUtils.localhost(com.rabbitmq.stream.impl.TestUtils.localhost) ConsumerInfo(com.rabbitmq.stream.impl.MonitoringTestUtils.ConsumerInfo) AtomicReference(java.util.concurrent.atomic.AtomicReference) CountDownLatch(java.util.concurrent.CountDownLatch) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) AtomicLong(java.util.concurrent.atomic.AtomicLong) Producer(com.rabbitmq.stream.Producer) ConfirmationHandler(com.rabbitmq.stream.ConfirmationHandler) IntConsumer(java.util.function.IntConsumer) Consumer(com.rabbitmq.stream.Consumer) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 8 with Consumer

use of com.rabbitmq.stream.Consumer in project rabbitmq-stream-java-client by rabbitmq.

the class StreamConsumerTest method consumerShouldBeClosedWhenStreamGetsDeleted.

@Test
void consumerShouldBeClosedWhenStreamGetsDeleted(TestInfo info) throws Exception {
    String s = streamName(info);
    environment.streamCreator().stream(s).create();
    int messageCount = 10_000;
    CountDownLatch publishLatch = new CountDownLatch(messageCount);
    Producer producer = environment.producerBuilder().stream(s).build();
    IntStream.range(0, messageCount).forEach(i -> producer.send(producer.messageBuilder().addData("".getBytes()).build(), confirmationStatus -> publishLatch.countDown()));
    assertThat(publishLatch.await(10, TimeUnit.SECONDS)).isTrue();
    CountDownLatch consumeLatch = new CountDownLatch(messageCount);
    StreamConsumer consumer = (StreamConsumer) environment.consumerBuilder().stream(s).offset(OffsetSpecification.first()).messageHandler((offset, message) -> consumeLatch.countDown()).build();
    assertThat(consumeLatch.await(10, TimeUnit.SECONDS)).isTrue();
    assertThat(consumer.isOpen()).isTrue();
    environment.deleteStream(s);
    TestUtils.waitAtMost(10, () -> !consumer.isOpen());
    assertThat(consumer.isOpen()).isFalse();
}
Also used : IntStream(java.util.stream.IntStream) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) StreamDoesNotExistException(com.rabbitmq.stream.StreamDoesNotExistException) IntConsumer(java.util.function.IntConsumer) TestUtils.latchAssert(com.rabbitmq.stream.impl.TestUtils.latchAssert) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) UnaryOperator(java.util.function.UnaryOperator) AtomicReference(java.util.concurrent.atomic.AtomicReference) TestUtils.b(com.rabbitmq.stream.impl.TestUtils.b) TestUtils.streamName(com.rabbitmq.stream.impl.TestUtils.streamName) ConfirmationHandler(com.rabbitmq.stream.ConfirmationHandler) DisabledIfRabbitMqCtlNotSet(com.rabbitmq.stream.impl.TestUtils.DisabledIfRabbitMqCtlNotSet) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ConsumerBuilder(com.rabbitmq.stream.ConsumerBuilder) Duration(java.time.Duration) MethodSource(org.junit.jupiter.params.provider.MethodSource) Host(com.rabbitmq.stream.Host) TestUtils.waitAtMost(com.rabbitmq.stream.impl.TestUtils.waitAtMost) EventLoopGroup(io.netty.channel.EventLoopGroup) Environment(com.rabbitmq.stream.Environment) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) UUID(java.util.UUID) Consumer(com.rabbitmq.stream.Consumer) Producer(com.rabbitmq.stream.Producer) String.format(java.lang.String.format) EnvironmentBuilder(com.rabbitmq.stream.EnvironmentBuilder) ConsumerInfo(com.rabbitmq.stream.impl.MonitoringTestUtils.ConsumerInfo) TestInfo(org.junit.jupiter.api.TestInfo) BackOffDelayPolicy(com.rabbitmq.stream.BackOffDelayPolicy) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) CountDownLatch(java.util.concurrent.CountDownLatch) AtomicLong(java.util.concurrent.atomic.AtomicLong) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Stream(java.util.stream.Stream) Collections(java.util.Collections) OffsetSpecification(com.rabbitmq.stream.OffsetSpecification) TestUtils.localhost(com.rabbitmq.stream.impl.TestUtils.localhost) Producer(com.rabbitmq.stream.Producer) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 9 with Consumer

use of com.rabbitmq.stream.Consumer in project rabbitmq-stream-java-client by rabbitmq.

the class StreamConsumerTest method useSubscriptionListenerToRestartExactlyWhereDesired.

@Test
@DisabledIfRabbitMqCtlNotSet
void useSubscriptionListenerToRestartExactlyWhereDesired() throws Exception {
    AtomicInteger subscriptionListenerCallCount = new AtomicInteger(0);
    AtomicInteger receivedMessages = new AtomicInteger(0);
    AtomicLong offsetTracking = new AtomicLong(0);
    AtomicBoolean started = new AtomicBoolean(false);
    int storeEvery = 10_000;
    String reference = "ref-1";
    CountDownLatch poisonLatch = new CountDownLatch(1);
    environment.consumerBuilder().name(reference).stream(stream).offset(OffsetSpecification.first()).subscriptionListener(subscriptionContext -> {
        subscriptionListenerCallCount.getAndIncrement();
        OffsetSpecification offsetSpecification = started.get() ? OffsetSpecification.offset(offsetTracking.get() + 1) : subscriptionContext.offsetSpecification();
        subscriptionContext.offsetSpecification(offsetSpecification);
    }).messageHandler((context, message) -> {
        receivedMessages.incrementAndGet();
        offsetTracking.set(context.offset());
        started.set(true);
        if ("poison".equals(new String(message.getBodyAsBinary()))) {
            poisonLatch.countDown();
        }
    }).autoTrackingStrategy().flushInterval(// long flush interval
    Duration.ofMinutes(60)).messageCountBeforeStorage(storeEvery).builder().build();
    AtomicInteger publishedMessages = new AtomicInteger(0);
    Producer producer = environment.producerBuilder().stream(stream).build();
    IntConsumer publish = messagesToPublish -> {
        publishedMessages.addAndGet(messagesToPublish);
        IntStream.range(0, messagesToPublish).forEach(i -> producer.send(producer.messageBuilder().addData("".getBytes()).build(), confirmationStatus -> {
        }));
    };
    publish.accept(storeEvery * 2 - 100);
    waitAtMost(5, () -> receivedMessages.get() == publishedMessages.get());
    Host.killConnection("rabbitmq-stream-consumer-0");
    publish.accept(storeEvery * 2);
    producer.send(producer.messageBuilder().addData("poison".getBytes()).build(), confirmationStatus -> {
    });
    latchAssert(poisonLatch).completes();
    // no duplicates because the custom offset tracking overrides the stored offset in the
    // subscription listener
    assertThat(receivedMessages).hasValue(publishedMessages.get() + 1);
}
Also used : IntStream(java.util.stream.IntStream) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) StreamDoesNotExistException(com.rabbitmq.stream.StreamDoesNotExistException) IntConsumer(java.util.function.IntConsumer) TestUtils.latchAssert(com.rabbitmq.stream.impl.TestUtils.latchAssert) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) UnaryOperator(java.util.function.UnaryOperator) AtomicReference(java.util.concurrent.atomic.AtomicReference) TestUtils.b(com.rabbitmq.stream.impl.TestUtils.b) TestUtils.streamName(com.rabbitmq.stream.impl.TestUtils.streamName) ConfirmationHandler(com.rabbitmq.stream.ConfirmationHandler) DisabledIfRabbitMqCtlNotSet(com.rabbitmq.stream.impl.TestUtils.DisabledIfRabbitMqCtlNotSet) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ConsumerBuilder(com.rabbitmq.stream.ConsumerBuilder) Duration(java.time.Duration) MethodSource(org.junit.jupiter.params.provider.MethodSource) Host(com.rabbitmq.stream.Host) TestUtils.waitAtMost(com.rabbitmq.stream.impl.TestUtils.waitAtMost) EventLoopGroup(io.netty.channel.EventLoopGroup) Environment(com.rabbitmq.stream.Environment) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) UUID(java.util.UUID) Consumer(com.rabbitmq.stream.Consumer) Producer(com.rabbitmq.stream.Producer) String.format(java.lang.String.format) EnvironmentBuilder(com.rabbitmq.stream.EnvironmentBuilder) ConsumerInfo(com.rabbitmq.stream.impl.MonitoringTestUtils.ConsumerInfo) TestInfo(org.junit.jupiter.api.TestInfo) BackOffDelayPolicy(com.rabbitmq.stream.BackOffDelayPolicy) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) CountDownLatch(java.util.concurrent.CountDownLatch) AtomicLong(java.util.concurrent.atomic.AtomicLong) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Stream(java.util.stream.Stream) Collections(java.util.Collections) OffsetSpecification(com.rabbitmq.stream.OffsetSpecification) TestUtils.localhost(com.rabbitmq.stream.impl.TestUtils.localhost) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AtomicLong(java.util.concurrent.atomic.AtomicLong) OffsetSpecification(com.rabbitmq.stream.OffsetSpecification) Producer(com.rabbitmq.stream.Producer) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) CountDownLatch(java.util.concurrent.CountDownLatch) IntConsumer(java.util.function.IntConsumer) DisabledIfRabbitMqCtlNotSet(com.rabbitmq.stream.impl.TestUtils.DisabledIfRabbitMqCtlNotSet) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 10 with Consumer

use of com.rabbitmq.stream.Consumer in project rabbitmq-stream-java-client by rabbitmq.

the class StreamConsumerTest method consume.

@Test
void consume() throws Exception {
    int messageCount = 100_000;
    CountDownLatch publishLatch = new CountDownLatch(messageCount);
    Client client = cf.get(new Client.ClientParameters().publishConfirmListener((publisherId, publishingId) -> publishLatch.countDown()));
    client.declarePublisher(b(1), null, stream);
    IntStream.range(0, messageCount).forEach(i -> client.publish(b(1), Collections.singletonList(client.messageBuilder().addData("".getBytes()).build())));
    assertThat(publishLatch.await(10, TimeUnit.SECONDS)).isTrue();
    CountDownLatch consumeLatch = new CountDownLatch(messageCount);
    AtomicLong chunkTimestamp = new AtomicLong();
    Consumer consumer = environment.consumerBuilder().stream(stream).offset(OffsetSpecification.first()).messageHandler((context, message) -> {
        chunkTimestamp.set(context.timestamp());
        consumeLatch.countDown();
    }).build();
    assertThat(consumeLatch.await(10, TimeUnit.SECONDS)).isTrue();
    assertThat(chunkTimestamp.get()).isNotZero();
    consumer.close();
}
Also used : IntStream(java.util.stream.IntStream) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) StreamDoesNotExistException(com.rabbitmq.stream.StreamDoesNotExistException) IntConsumer(java.util.function.IntConsumer) TestUtils.latchAssert(com.rabbitmq.stream.impl.TestUtils.latchAssert) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) UnaryOperator(java.util.function.UnaryOperator) AtomicReference(java.util.concurrent.atomic.AtomicReference) TestUtils.b(com.rabbitmq.stream.impl.TestUtils.b) TestUtils.streamName(com.rabbitmq.stream.impl.TestUtils.streamName) ConfirmationHandler(com.rabbitmq.stream.ConfirmationHandler) DisabledIfRabbitMqCtlNotSet(com.rabbitmq.stream.impl.TestUtils.DisabledIfRabbitMqCtlNotSet) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ConsumerBuilder(com.rabbitmq.stream.ConsumerBuilder) Duration(java.time.Duration) MethodSource(org.junit.jupiter.params.provider.MethodSource) Host(com.rabbitmq.stream.Host) TestUtils.waitAtMost(com.rabbitmq.stream.impl.TestUtils.waitAtMost) EventLoopGroup(io.netty.channel.EventLoopGroup) Environment(com.rabbitmq.stream.Environment) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) UUID(java.util.UUID) Consumer(com.rabbitmq.stream.Consumer) Producer(com.rabbitmq.stream.Producer) String.format(java.lang.String.format) EnvironmentBuilder(com.rabbitmq.stream.EnvironmentBuilder) ConsumerInfo(com.rabbitmq.stream.impl.MonitoringTestUtils.ConsumerInfo) TestInfo(org.junit.jupiter.api.TestInfo) BackOffDelayPolicy(com.rabbitmq.stream.BackOffDelayPolicy) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) CountDownLatch(java.util.concurrent.CountDownLatch) AtomicLong(java.util.concurrent.atomic.AtomicLong) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Stream(java.util.stream.Stream) Collections(java.util.Collections) OffsetSpecification(com.rabbitmq.stream.OffsetSpecification) TestUtils.localhost(com.rabbitmq.stream.impl.TestUtils.localhost) AtomicLong(java.util.concurrent.atomic.AtomicLong) IntConsumer(java.util.function.IntConsumer) Consumer(com.rabbitmq.stream.Consumer) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Consumer (com.rabbitmq.stream.Consumer)25 Environment (com.rabbitmq.stream.Environment)24 OffsetSpecification (com.rabbitmq.stream.OffsetSpecification)22 CountDownLatch (java.util.concurrent.CountDownLatch)22 Test (org.junit.jupiter.api.Test)22 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)21 EnvironmentBuilder (com.rabbitmq.stream.EnvironmentBuilder)20 Producer (com.rabbitmq.stream.Producer)19 TestUtils.latchAssert (com.rabbitmq.stream.impl.TestUtils.latchAssert)19 TestUtils.localhost (com.rabbitmq.stream.impl.TestUtils.localhost)19 EventLoopGroup (io.netty.channel.EventLoopGroup)19 BeforeEach (org.junit.jupiter.api.BeforeEach)19 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)19 Collections (java.util.Collections)18 List (java.util.List)18 ConfirmationHandler (com.rabbitmq.stream.ConfirmationHandler)17 Duration (java.time.Duration)17 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)16 TestInfo (org.junit.jupiter.api.TestInfo)16 AfterEach (org.junit.jupiter.api.AfterEach)15