Class TopicsClient.TopicClient

java.lang.Object
com.bakdata.kafka.admin.TopicsClient.TopicClient
Enclosing class:
TopicsClient

public final class TopicsClient.TopicClient extends Object
A client for a specific topic.
  • Method Details

    • createIfNotExists

      public void createIfNotExists(TopicSettings settings, Map<String,String> config)
      Creates a new Kafka topic with the specified number of partitions if it does not yet exist. If the topic exists, its configuration is not updated.
      Parameters:
      settings - settings for number of partitions and replicationFactor
      config - topic configuration
      See Also:
    • createIfNotExists

      public void createIfNotExists(TopicSettings settings)
      Creates a new Kafka topic with the specified number of partitions if it does not yet exist.
      Parameters:
      settings - settings for number of partitions and replicationFactor
      See Also:
    • delete

      public void delete()
      Delete a Kafka topic.
    • getSettings

      public Optional<TopicSettings> getSettings()
      Get the current settings of a Kafka topic.
      Returns:
      settings of topic including number of partitions and replicationFactor
    • exists

      public boolean exists()
      Checks whether a Kafka topic exists.
      Returns:
      whether a Kafka topic with the specified name exists or not
    • describe

      public Optional<org.apache.kafka.clients.admin.TopicDescription> describe()
      Describe a Kafka topic.
      Returns:
      topic description
    • create

      public void create(TopicSettings settings, Map<String,String> config)
      Creates a new Kafka topic with the specified number of partitions.
      Parameters:
      settings - settings for number of partitions and replicationFactor
      config - topic configuration
    • create

      public void create(TopicSettings settings)
      Creates a new Kafka topic with the specified number of partitions.
      Parameters:
      settings - settings for number of partitions and replicationFactor
    • deleteIfExists

      public void deleteIfExists()
      Delete a Kafka topic only if it exists.
    • config

      public ConfigClient config()
      Create a client for the configuration of this topic.
      Returns:
      config client