You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Provectus Kafka UI中正常显示Protobuf格式的Kafka主题内容?

问题:Provectus Kafka UI展示Protobuf主题时显示不可读二进制内容

我尝试在Provectus Kafka UI中展示存储Protobuf格式数据的Kafka主题,但UI里的字段都是不可读的二进制格式。以下是我的Kafka UI配置文件:

dynamic.config.enabled: true
kafka:
  zookeeper:
    connect: zookeeper:2181
  clusters:
  -
    name: local
    bootstrapServers: localhost:9092
    # Other Cluster configuration omitted ...
    serde:
    - name: ProtobufFile
      #classNane: com.provectus.kafka.ui.serdes.builtin.ProtobufFileSerde==> Tried with this also
      classNane: com.provectus.kafka.ui.serdes.builtin.ProtobufRawSerde
      properties:
        # protobufFilesDir specifies root location for proto files (will be scanned recursively)
        # NOTE: if 'protobufFilesDir' specified, then 'protobufFile' and 'protobufFiles' settings will be ignored
        protobufFilesDir: "/kafka-ui/app"
        # protobufMessageName is the default protobuf type that is used to deserialize
        protobufFile: /kafka-ui/app/events.proto
        # the message's value if the topic is not found in protobufMessageNameByTopic.<br />
        protobufMessageName: EventInQ
        # mapping of topic names to protobuf types, that will be used for VALUES  serialization/deserialization
        # optional
        protobufMessageNameByTopic:
          "pkt1": .xx.xxx.events.PKT1
          "pkt2": .xx.xxx.events.PKT2
          "pkts": .xx.xxx.events.PKTS
          "pktErr": .xx.xxx.events.PKTErr

请问如何让这些内容以可读的字符串形式正常显示?


解决方案
  • 修正配置拼写错误:将配置中的classNane改为className,这是导致Serde无法正确加载的核心问题之一。
  • 选择匹配的Serde实现:
    • 若你的Protobuf数据携带完整元数据(FileDescriptorSet),使用com.provectus.kafka.ui.serdes.builtin.ProtobufFileSerde
    • 若为原始二进制Protobuf(无内置元数据),使用com.provectus.kafka.ui.serdes.builtin.ProtobufRawSerde,同时确保所有关联的proto文件都在指定的扫描目录内
  • 清理冲突配置项:根据配置注释,protobufFilesDir优先级高于protobufFile,两者不能同时生效。如果仅需单个proto文件,删除protobufFilesDir配置,保留protobufFile即可。
  • 修正消息名称格式:protobufMessageNameByTopic中的消息类型名称不需要开头的.,应改为xx.xxx.events.PKT1这类格式。
  • 验证proto文件有效性:确认events.proto中已正确定义所有映射的消息类型(PKT1、PKT2等),语法无错误,且所有依赖的proto文件都已存在。
  • 重启Kafka UI服务:配置修改后必须重启服务才能生效。
  • UI中手动指定Serde:进入目标主题的消息页面,在顶部的「Serde」下拉菜单中选择你配置的ProtobufFile Serde,而非默认的二进制选项。

内容的提问来源于stack exchange,提问作者Champak Das

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 10:17:34