我正试图在Scala中使用Akka Kafka来从带有berberos的kafka经纪人那里消费。
我使用Akka-stream-kafka 0.11-M2和kafka客户端0.9.0.1。我尝试运行jvm参数-Djava.security.auth.login.config = / bp2 / bpa / bin / kafka_client_jaas.conf,添加最后两行withProperty()行
def kafkaConsumerSettings(groupId: String, kafkaHost: String, universalId: String, topics: Set[String]): ConsumerSettings[Array[Byte], String] =
ConsumerSettings(actorSystem, new ByteArrayDeserializer, new StringDeserializer, topics)
.withBootstrapServers(kafkaHost)
.withClientId(universalId)
.withGroupId(groupId)
.withProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest")
.withProperty(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SASL_PLAINTEXT")
.withProperty("sasl.kerberos.service.name", "kafka")
}
运行代码时我得到
{"errors": "Failed to construct kafka consumer"}