问题
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.
回答1:
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()
来源:https://stackoverflow.com/questions/62187382/differentiating-between-non-existent-and-un-authorized-topic-in-librdkafka