Class KafkaConsumerHelper

java.lang.Object
net.bugreaper.modules.kafka.setup.KafkaConsumerHelper
Direct Known Subclasses:
Kafka

public class KafkaConsumerHelper extends Object
Kafka consumer helper responsible for consuming messages from Kafka topics.
  • Field Details

    • bootStrapServer

      protected final String bootStrapServer
    • adminClient

      protected final KafkaAdminHelper adminClient
    • awaitMs

      protected volatile int awaitMs
      Default await timeout for tests, in milliseconds.
    • awaitPollInterval

      protected volatile int awaitPollInterval
      Default await polling interval in milliseconds for tests.
    • consumerTimeoutMs

      protected volatile int consumerTimeoutMs
      Default consumer timeout in milliseconds.
    • maxConsumedMessages

      protected volatile int maxConsumedMessages
      Default maximum number of messages consumed by a grab operation.
    • uniqueConsumerGroup

      protected volatile boolean uniqueConsumerGroup
      Enables using a unique consumer group ID for each test run.
    • reverseMessages

      protected volatile boolean reverseMessages
      Enables reversing consumed messages in the list so that newer messages are checked first.
  • Constructor Details

    • KafkaConsumerHelper

      protected KafkaConsumerHelper(String bootStrapServer)
  • Method Details

    • consumer

      protected org.apache.kafka.clients.consumer.KafkaConsumer<String,String> consumer()
    • grabMessagesFromTopicMethod

      protected net.bugreaper.core.assertable.AssertableStringList grabMessagesFromTopicMethod(String topic, String key)
    • getAllTopicsNamesMethod

      protected net.bugreaper.core.assertable.AssertableStringList getAllTopicsNamesMethod()
    • getTopicMessageCountMethod

      protected int getTopicMessageCountMethod(String topic)
    • assertCountInTopicMethod

      protected void assertCountInTopicMethod(String topic, int expectedCount, int awaitMs)
    • seeTopicIsNotEmptyMethod

      protected void seeTopicIsNotEmptyMethod(String topic, int awaitMs)
    • seeTopicIsEmptyMethod

      protected void seeTopicIsEmptyMethod(String topic, int awaitMs)