如何描述主题kafka的配置?

问题描述

我想描述一个主题的配置。我使用confluent-kafka-python librairie(版本1.5.0)开发了一个脚本,而我的python版本是2.7。 我的最终目标是能够更改主题的保留时间(retention.ms),但是为此,我需要提取主题的所有配置并更改我想要的内容,并保留其他已定义的内容。 / p>

我的脚本:

def describe_topic(admin_client,topic):

resources = [ConfigResource(confluent_kafka.admin.RESOURCE_TOPIC,topic)]
fs = admin_client.describe_configs(resources)
for resource,f in fs.items():
    remote_config = f.result()
    print(remote_config)
    return resource,remote_config

但是我有这个错误

错误
在describe_topic
中的文件“ kafka.py”第192行 资源= [ConfigResource(confluent_kafka.admin.RESOURCE_TOPIC,主题)]
init
中的文件“ environment / mamba-6Od8R-HF-py2.7 / lib / python2.7 / site-packages / kafka / admin / config_resource.py”,第33行 resource_type = ConfigResourceType [str(resource_type).upper()]#注释:disable-msg = unsubscriptable-object
中,第394行中的文件“ /product/tedhdev/environment/mamba-6Od8R-HF-py2.7/lib/python2.7/site-packages/enum/init.py” getitem
返回cls。 member_map [名称]
KeyError:“ 2” \

有人可以帮助我吗? 非常感谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)