【发布时间】:2021-10-02 04:47:53
【问题描述】:
从 kafka 主题读取事件时出错
'org.apache.kafka.common.errors.SerializationException: 错误 反序列化 id 4494 的 Avro 消息原因: org.apache.kafka.common.errors.SerializationException:找不到 查找时在作者的架构中指定的类 topLevelRecord 特定记录的阅读器架构。'
final Map<String, String> schemaMap = Collections.singletonMap(AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, schemaServerURL);
final SpecificAvroSerde<VertexTransactionRawEventValue> vertexTransactionRawEventValueAvroSerde = new SpecificAvroSerde<>();
vertexTransactionRawEventValueAvroSerde.configure(schemaMap, false);
KStream<String, VertexTransactionRawEventValue> vertexTransactionRawEventValueKStream =
streamsBuilder.stream(vertexTransactionRawEventTopic,Consumed.with(Serdes.String(), vertexTransactionRawEventValueAvroSerde));
但是,当我将事件读取为 GenericRecord 类型而不是 VertexTransactionRawEventValue 时,我能够读取事件。
KStream<String, VertexTransactionRawEventValue> vertexTransactionRawEventValueKStream =
streamsBuilder.stream(vertexTransactionRawEventTopic);
【问题讨论】:
标签: java apache-kafka apache-kafka-streams avro