Class ConsumerCleanUpRunner

java.lang.Object
com.bakdata.kafka.consumer.ConsumerCleanUpRunner
All Implemented Interfaces:
CleanUpRunner, AutoCloseable

public final class ConsumerCleanUpRunner extends Object implements CleanUpRunner
Runner to clean() or reset() a ConsumerApp clean() deletes the consumer group specified in the constructor. reset() resets the consumer group to the earliest offset. Both methods also run hooks registered in a ConsumerCleanUpConfiguration.
  • Method Details

    • create

      public static ConsumerCleanUpRunner create(@NonNull @NonNull Map<String,Object> kafkaProperties, @NonNull @NonNull String groupId)
      Create a new ConsumerCleanUpRunner with default ConsumerCleanUpConfiguration
      Parameters:
      kafkaProperties - configuration to connect to Kafka admin tools
      groupId - consumer group id to clean up
      Returns:
      ConsumerCleanUpRunner
    • create

      public static ConsumerCleanUpRunner create(@NonNull @NonNull Map<String,Object> kafkaProperties, @NonNull @NonNull String groupId, @NonNull @NonNull ConsumerCleanUpConfiguration configuration)
      Create a new ConsumerCleanUpRunner
      Parameters:
      kafkaProperties - configuration to connect to Kafka admin tools
      groupId - consumer group id to clean up
      configuration - configuration for hooks that are called when running clean()
      Returns:
      ConsumerCleanUpRunner
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface CleanUpRunner
    • clean

      public void clean()
      Description copied from interface: CleanUpRunner
      Clean all resources associated with an application
      Specified by:
      clean in interface CleanUpRunner
    • reset

      public void reset()
      Reset your Consumer app by resetting consumer group offsets