Kafka 连接 - 字符串不能转换为结构 [英] Kafka connect - string cannot be casted to struct

查看:32
本文介绍了Kafka 连接 - 字符串不能转换为结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做融合 kafka 连接版本 5.2.3 的 poc.我们正在尝试将主题消息复制到一个文件作为备份,并在需要时从该文件复制回主题.

I am doing poc of confluent kafka connect version 5.2.3. We are trying to copy message of topic a file as backup and from this file back to topic when we need it.

主题有键 = 字符串值=protbuf

Topic has Key =string Value=protbuf

我正在使用

key.convertor=org.apache.kafka.connect.storgare.StringConvertorvalue.convertor=com.blueapron.connect.protobuf.ProtobufConvertorvalue.convertor.protoClassName=

接收器配置

name=test
connector.class=FileStreamSink
tasks.max=1
file=test.txt
topics=testtopic

源配置

name=test
connector.class=FileStreamSource
tasks.max=1
file=test.txt
topics=testtopic_connect

我能够成功将其下沉到文件内容如下的文件

I am able successfully sink it to a file with file content as below

Struct{<message in name value pair>}
Struct{<message in name value pair>}

....

我用来将其恢复到不同主题的同一个文件.当我运行源时它抛出错误

The same file i use to source it back to a different topic. When i run the source it throw error

字符串无法转换为 org.apache.kafka.connect.data.Struct.

String cannot be casted to org.apache.kafka.connect.data.Struct.

问题是

  • 当我的 kafka 主题具有键值对时,为什么我在文件中看不到任何键.
  • 为什么 source 无法将内容从文件复制到主题并抛出与转换相关的错误.
  • 当我使用 kafka 提供的 ByteArrayConvertor 时,我遇到了类似的错误.字符串不能转换为字节.理想情况下,ByteArrayConvertor 应该适用于任何类型的数据.
  • blueapron 是否仅适用于 protobuf3 版本?

推荐答案

blueapron 是否仅适用于 protobuf3 版本?

Does blueapron only works with protobuf3 version?

是的,因为我们只在内部使用 proto3(我们需要生成 Python、Java 和 Ruby 代码 - Ruby 仅适用于 proto3),不幸的是,我们在第一次构建这个工具时没有构建对 proto2 定义的支持.我已经更新了项目自述文件以反映这一点(https://github.com/blueapron/kafka-connect-protobuf-converter#compatibility).

Yes, since we only use proto3 internally (we needed Python, Java and Ruby code generation - Ruby is only available for proto3), unfortunately we didn't build in support for proto2 definitions when first building this tool. I've updated the project readme to reflect that (https://github.com/blueapron/kafka-connect-protobuf-converter#compatibility).

这篇关于Kafka 连接 - 字符串不能转换为结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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