区分librdkafka中不存在和未经授权的主题 [英] Differentiating between non-existent and un-authorized topic in librdkafka

查看:71
本文介绍了区分librdkafka中不存在和未经授权的主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定主题是否经过授权?

How can I make sure if a topic is authorized or not ?

我需要这个,因为在我的消费者中,我获取了所有已知主题的元数据,然后进行了分配呼叫.元数据调用不会提供未授权的主题和不存在的主题.如果一个主题不存在,我将创建一个主题,如果一个主题未经授权,我将失败.但是我没有办法区分不存在和未经授权的话题.

I need this because, in my consumer I get the meta data for all the known topics and then do assign call. The metadata call doesn't give the un-authorized topics and non-existent topic. If a topic doesn't exist, I'll create one and if a topic is unauthorized, I have to fail. But I don't have a way to differentiate between non-existent and unauthorized topic.

推荐答案

您可以尝试列出所有主题,如果该主题存在,则该主题将出现在列表中.我没有使用librdkafka,但仍然使用链接,作者说以下功能应该给你(没有主题参数).

You can try listing all the topics, if the topic exists it will be there in the list. I did not use librdkafka but still from the link, the author says the following function should give you (without the topic argument).

rd_kafka_metadata()

这篇关于区分librdkafka中不存在和未经授权的主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆