什么是 Apache Kafka 主题名称限制? [英] What are Apache Kafka topic name limitations?

查看:23
本文介绍了什么是 Apache Kafka 主题名称限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚尝试创建一个 Kafka 主题 "user:created" 并在 Kafka 日志中看到了这个错误:Invalid character ':' in value part of property.我用谷歌搜索,发现在邮件列表中人们也在谈论弃用 ._ 符号.

Apache Kafka 主题名称中不能使用哪些符号?

解决方案

根据 kafka 10 的源代码

val legalChars = "[a-zA-Z0-9\\._\\-]";私有 val maxNameLength = 255private val rgx = new Regex(legalChars + "+")

所以,最大长度为 255 个符号和字母,.(点)、_(下划线)、-(减号)可以使用用过

在 Kafka 0.10 中,maxNameLength 从 255 更改为 249.请参阅commita/p>

带有句点 . 或下划线 _ 的主题可能会在内部数据结构中发生冲突,因此建议您使用其中一种但不要同时使用(来源).

I have just tried creating a Kafka topic "user:created" and saw this error in Kafka logs: Invalid character ':' in value part of property. I googled and found that in a mailing list people are talking about deprecating . and _ symbols too.

Which symbols can't be used in Apache Kafka topic names?

解决方案

According to source code for kafka 10

val legalChars = "[a-zA-Z0-9\\._\\-]"
private val maxNameLength = 255
private val rgx = new Regex(legalChars + "+")

So, max length is 255 symbols and letters, . (dot), _ (underscore), - (minus) can use used

In the Kafka 0.10 the maxNameLength was changed from 255 to 249. See commit

Also topics with a period . or underscore _ could collide in internal data structures, so you are advised to use either but not both (source).

这篇关于什么是 Apache Kafka 主题名称限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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