Skip to content

Instantly share code, notes, and snippets.

@luccabb
Created November 29, 2021 05:45
Show Gist options
  • Save luccabb/71f593f7717853568c26d1c95ec019bf to your computer and use it in GitHub Desktop.
Save luccabb/71f593f7717853568c26d1c95ec019bf to your computer and use it in GitHub Desktop.
from kafka.admin import KafkaAdminClient, NewTopic
admin_client = KafkaAdminClient(
bootstrap_servers="localhost:9093",
client_id='test'
)
topic_list = []
topic_list.append(NewTopic(name="il181-topic", num_partitions=3, replication_factor=1))
admin_client.create_topics(new_topics=topic_list, validate_only=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment