java - 如何从spring-cloud-stream-kafka-stream中的avro模式名称重定向类名?
问题描述
我有一个消费 Kafka 主题的消费者应用程序。当生产者通过 Avro 发布类类型的记录时,它会按照模式注册表上的模式Reservation
分配模式名称。my_reservations
在我的消费者应用程序中,我将配置设置为
default.value.serde: io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde
和处理器作为
@Bean
public java.util.function.Consumer<KStream<String, Reservation>> process() {
return input.foreach((key, value) -> {
System.out.println(" Value: " + value);
});
}
但是我从消费者那里得到了错误,因为Reservation
类路径是reservation.Reservation
.
Caused by: org.apache.kafka.common.errors.SerializationException: Could not find class reservation.my_reservations specified in writer's schema whilst finding reader's schema for a SpecificRecord.
我该如何解决?我正在使用官方文档中提到的功能方式来创建消费者。
解决方案
推荐阅读
- c++ - (C++) 使用函数的回文数
- django - 计算 django 中过滤查询中的所有类别对象?
- flutter - 如何在构建之前获取小部件的尺寸?
- python - 即使在修改可执行文件后也检测到硒
- java - vlcj 从 rtsp 流中获取元数据
- ios - 为 Flutter App 中通过 CocoaPods 提供的库提供额外的翻译
- python - 无法重现网格搜索的结果
- javascript - 存储要使用 php 读取的 javascript 变量的 cookie 出错
- javascript - (React) 根据状态变量动态显示内容取决于另一个状态变量
- pandas - 从 2 个数据帧的 if 条件创建新数据帧