我可以通过API在Kafka中创建主题吗?使用任何python库 [英] Could I create a topic in Kafka via API? Using any python library
问题描述
我正在尝试通过API查找有关在Kafka中创建主题的信息,因为我需要自动执行一些任务,如果有人知道是否有可能,那将很棒,我在这里阅读:
I'm trying to find information about the topic creation in Kafka via API, because I need to automate some tasks, It would be great if someone knows if it's possible, I was reading here:
https://docs.confluent.io/current/kafka-rest/api.html#crest-api-v3
但这对我不起作用.如果我尝试做
But it didn't work for me. If I try to do
GET in /v3/clusters/ --> returns code 404
推荐答案
我在回答自己的问题.
我将发现的内容发布到这里,只有在配置了kafka rest代理的情况下,rest端点才有用,否则请尝试使用任何外部库.
I post here what I found, that rest endpoint is useful only in case you have configured kafka rest proxy, if not, try to use any external library.
如果找到这个:
https://docs.confluent.io/current/clients/confluent-kafka-python/index.html
"Kafka Admin客户端:创建,查看,更改,删除主题和资源."
"Kafka Admin client: create, view, alter, delete topics and resources."
这篇关于我可以通过API在Kafka中创建主题吗?使用任何python库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!