[英]Error when use kafka-avro-console-consumer consume avro message sent by spring cloud stream kafka
I tried official schema-registry-confluent example (consumer/producer) with my local installed confluent 4.0.0, it can send "sensor" avro message when send post request and receive in listener, but when I use kafka-avro-console-consumer tool shipped with confluent 4.0.0 to view avro message sent, the tool raised the following error (a). 我用本地安装的confluent 4.0.0尝试了官方的schema-registry-confluent示例(消费者/生产者),当发送发布请求并在侦听器中接收时,它可以发送“传感器” avro消息,但是当我使用kafka-avro-console-消费者工具随融合版4.0.0一起提供,以查看发送的Avro消息,该工具引发以下错误(a)。 I also tried to consume avro message sent by kafka-avro-console-producer tool (and the message can be shown correctly in kafka-avro-console-consumer tool) , it reported the following error (b).
我还尝试使用由kafka-avro-console-producer工具发送的avro消息(该消息可以在kafka-avro-console-consumer工具中正确显示),它报告了以下错误(b)。 Doesn't the given example support confluent 4.0.0?
给定的示例不支持融合4.0.0吗? Many thanks!
非常感谢!
(a) kafka-avro-console-consumer error => (a)kafka-avro-console-consumer错误=>
ERROR Unknown error when running consumer: (kafka.tools.ConsoleConsumer$:107) org.apache.kafka.common.errors.SerializationException: Error deserializing Avro message for id -1 Caused by: org.apache.kafka.common.errors.SerializationException: Unknown magic byte! 错误运行使用者时发生未知错误:(kafka.tools.ConsoleConsumer $:107)org.apache.kafka.common.errors.SerializationException:反序列化ID -1的Avro消息时出错,原因是:org.apache.kafka.common.errors。 SerializationException:未知的魔术字节!
(b) listener error => (b)监听器错误=>
org.springframework.messaging.converter.MessageConversionException: Could not read JSON: Invalid UTF-32 character 0x51473863 (above 0x0010ffff) at char #1, byte #7); org.springframework.messaging.converter.MessageConversionException:无法读取JSON:字符#1的字节#7处无效的UTF-32字符0x51473863(0x0010ffff以上); nested exception is java.io.CharConversionException: Invalid UTF-32 character 0x51473863 (above 0x0010ffff) at char #1, byte #7) at org.springframework.messaging.converter.MappingJackson2MessageConverter.convertFromInternal(MappingJackson2MessageConverter.java:234) ~[spring-messaging-5.1.0.BUILD-SNAPSHOT.jar!/:5.1.0.BUILD-SNAPSHOT]
嵌套的异常是java.io.CharConversionException:org.springframework.messaging.converter.MappingJackson2MessageConverter.convertFromInternal(MappingJackson2MessageConverter.java:234)处的无效UTF-32字符0x51473863(在0x0010ffff以上,在char#1,字节#7处) -messaging-5.1.0.BUILD-SNAPSHOT.jar!/:5.1.0.BUILD-SNAPSHOT]
Every time there is a MessageConversionException
it simply means that the provided Message Converters could not convert Message. 每当出现
MessageConversionException
它仅表示提供的消息转换器无法转换Message。 . 。 .
。 and rightfully so as we can't handle every scenario, only the common ones.
而且理所当然的,因为我们不能处理所有情况,只有常见的情况。 So, you should implement custom Message Converter (either from scratch or extending one of the existing ones).
因此,您应该实现自定义消息转换器(从头开始或扩展现有的消息转换器之一)。 Here is more info on how to define custom Message Converter https://docs.spring.io/spring-cloud-stream/docs/Fishtown.M1/reference/htmlsingle/#spring-cloud-stream-overview-user-defined-message-converters
这是有关如何定义自定义消息转换器的更多信息https://docs.spring.io/spring-cloud-stream/docs/Fishtown.M1/reference/htmlsingle/#spring-cloud-stream-overview-user-defined-消息转换器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.