首页 > 解决方案 > 无权访问事件中心命名空间内的主题

问题描述

我有带有两个事件中心(event-hubevent-hub-2)的事件中心命名空间。为了建立连接,我使用 Kafka——当然命名空间是标准层。当我尝试连接到第二个 EH(event-hub-2作为 Kafka 主题,连接字符串作为 Kafka 密码)时,我得到了以下堆栈跟踪:

2021-06-17T15:56:04.976Z -  WARN: [NetworkClient] [Consumer clientId=consumer-$Default-1, groupId=$Default] Error while fetching metadata with correlation id 11 : {event-hub=TOPIC_AUTHORIZATION_FAILED}
2021-06-17T15:56:04.980Z - ERROR: [Metadata] [Consumer clientId=consumer-$Default-1, groupId=$Default] Topic authorization failed for topics [event-hub]
2021-06-17T15:56:05.007Z - ERROR: [KafkaConsumerActor] [9e1ad] Exception when polling from consumer, stopping actor: org.apache.kafka.common.errors.TopicAuthorizationException: Not authorized to access topics: [event-hub]
org.apache.kafka.common.errors.TopicAuthorizationException: Not authorized to access topics: [event-hub]

我的问题是:为什么我什至没有尝试从堆栈跟踪连接到主题/EH 时会得到这种堆栈跟踪?这是一个奇怪的...

标签: apache-kafkaazure-eventhub

解决方案


如果您在两种情况下都使用相同的消费者组,则您的消费者需要对该消费者组中使用的所有主题的读取权限,请尝试更改 group.id 并再次测试。


推荐阅读