KafkaStream createTopic 不遵守 Kafka 服务器的 auto.create.topics.enable 设置

KafkaStream createTopic not respecting Kafka server's auto.create.topics.enable settings

我们有一个生产 Kafka 集群,最近被一堆新主题污染了。 Kafka集群有以下设置:

auto.create.topics.enable=false
delete.topic.enable=false

经过调查,我发现这些主题是由使用 KafkaStream 的 createTopic 方法的客户团队创建的: org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster#createTopic(java.lang.String, int, int)

这是否意味着 KafkaStream 的主题创建不通过 auto.create.topics.enable 的服务器端代理设置?这是否意味着 createTopic* 方法不算作自动创建主题?如果是这样,我们如何阻止客户团队以编程方式在 Kafka 集群上创建主题?

编辑:kafka 集群是 运行 10.1.1,Kafka 和 Kafka-Stream 的客户端是 运行 1.0.0

配置 auto.create.topics.enable 仅在客户端尝试 read/write from/to 不存在的主题(或查询不存在的主题的元数据)时适用。

Kafka Streams,确实使用 CreateTopic 请求明确创建主题,因此 auto.create.topics.enable 不适用。

您可以为集群设置一些 ACL 来控制谁可以创建主题:https://kafka.apache.org/0101/documentation.html#security_authz

Note: if you disallow the team that uses Kafka Streams to create new topics, you make it very hard for them to use Kafka Streams. Kafka Streams cannot operate without those topics and you are required to create those topics manually (with correct configurations) to not break the Kafka Streams application.