Apache kafka 无法读取卡夫卡主题avro消息

Apache kafka 无法读取卡夫卡主题avro消息,apache-kafka,avro,debezium,Apache Kafka,Avro,Debezium,Debezium连接器的Kafka连接事件是Avro编码的 在传递给Kafka connect standalone服务的connect-standalone.properties中提到了以下内容 key.converter=io.confluent.connect.avro.AvroConverter value.confluent=io.confluent.connect.avro.AvroConverter internal.key.converter=io.confluent.conne

Debezium连接器的Kafka连接事件是Avro编码的

在传递给Kafka connect standalone服务的connect-standalone.properties中提到了以下内容

key.converter=io.confluent.connect.avro.AvroConverter
value.confluent=io.confluent.connect.avro.AvroConverter
internal.key.converter=io.confluent.connect.avro.AvroConverter
internal.value.converter=io.confluent.connect.avro.AvroConverter
schema.registry.url=http://ip_address:8081
internal.key.converter.schema.registry.url=http://ip_address:8081
internal.value.converter.schema.registry.url=http://ip_address:8081
使用以下属性配置卡夫卡消费代码:

Properties props = new Properties();
props.put("bootstrap.servers", "ip_address:9092");
props.put("zookeeper.connect", "ip_address:2181");
props.put("group.id", "test-consumer-group");
props.put("auto.offset.reset","smallest");
//Setting auto comit to false to ensure that on processing failure we retry the read
props.put("auto.commit.offset", "false");
props.put("key.converter.schema.registry.url", "ip_address:8081");
props.put("value.converter.schema.registry.url", "ip_address:8081");
props.put("schema.registry.url", "ip_address:8081");
在使用者实现中,以下是读取键和值组件的代码。我使用REST从模式注册表中获取键和值的模式

GenericDatumReader<GenericRecord> reader = new GenericDatumReader<GenericRecord>(schema);
return reader.read(null, DecoderFactory.get().binaryDecoder(byteData, null));
GenericDatumReader=新的GenericDatumReader(模式);
返回reader.read(null,DecoderFactory.get().binaryDecoder(byteData,null));
解析密钥工作得很好。在解析消息的值部分时,我得到ArrayIndexOutOfBoundsException

下载了Avro的源代码并进行了调试。发现GenericDatumReader.readInt方法返回负值。该值应为数组(符号)的索引,因此应为正值

尝试使用kafka avro独立使用者消费事件,但它也抛出了ArrayIndexOutOfBoundsException。因此,我猜测消息在Kafka connect(producer)中编码不正确&问题在于配置

问题如下:

  • 在生产者或消费者处传递的配置是否有任何错误
  • 为什么密钥反序列化可以工作,但没有值
  • 还需要做些什么才能让事情顺利进行吗?(比如在某处指定字符编码)
  • 带Avro的Debezium可以用于生产吗,或者现在它是一个实验特性吗?Debezium Avro上的帖子特别指出,涉及Avro的例子将在将来包括在内
  • 很多帖子中,Avro反序列化将ArrayIndex抛出BoundsException,但无法将其与我面临的问题联系起来。

    遵循中的步骤&现在一切正常