티스토리 뷰

공부

[Java] kafka create topic

승가비 2022. 1. 14. 07:23
728x90
public static void create(String name) {
   AdminClient client = AdminClient.create(properties());
   NewTopic topic = new NewTopic(
      name,
      (int)conf().get("partition"),
      Short.parseShort(String.valueOf(conf().get("replication.factor"))));

   client.createTopics(Collections.singleton(topic));
   client.close();
}

https://stackoverflow.com/questions/64077406/why-is-adminclient-not-failing-when-creating-a-topic-with-kafka-cluster-not-runn

 

Why is AdminClient not failing when creating a topic with Kafka cluster not running?

Why don't I get an error message when I run the following producer code and Kafka is not even running? I would expect the createTopics method to throw an exception, but it doesn't happen. Why? final

stackoverflow.com

https://stackoverflow.com/questions/56539335/how-to-configure-kafka-topic-retention-policy-during-creation-with-spring

 

How to configure kafka topic retention policy during creation with Spring?

I need to configure retention policy of a particular topic during creation. I tried to look for solution i could only find command level alter command as below ./bin/kafka-topics.sh --zookeeper

stackoverflow.com

https://stackoverflow.com/questions/27036923/how-to-create-a-topic-in-kafka-through-java/70729733#70729733

 

How to create a Topic in Kafka through Java

I want to create a topic in Kafka (kafka_2.8.0-0.8.1.1) through java. It is working fine if I create a topic in command prompt, and If I push message through java api. But I want to create a topic

stackoverflow.com

 

728x90
댓글