Apache kafka 使用ksql datagen实用程序生成的数据反序列化异常
从以下模式从ksql datagen实用程序生成的示例流-Apache kafka 使用ksql datagen实用程序生成的数据反序列化异常,apache-kafka,avro,apache-kafka-streams,confluent-schema-registry,Apache Kafka,Avro,Apache Kafka Streams,Confluent Schema Registry,从以下模式从ksql datagen实用程序生成的示例流- { "type": "record", "name": "users", **"namespace": "com.example",** "fields": [ { "name": "registertime", "type": { "type":"long", "arg.pro
{
"type": "record",
"name": "users",
**"namespace": "com.example",**
"fields": [
{
"name": "registertime",
"type": {
"type":"long",
"arg.properties":{
"range":{"min":1487715775521,"max":1519273364600}
}
}
},
{
"name": "userid",
"type": {
"type":"string",
"arg.properties":{"regex":"User_[1-9][0-2]"}
}
},
{
"name": "regionid",
"type": {
"type":"string",
"arg.properties":{"regex":"Region_[1-9]"}
}
},
{
"name": "gender",
"type": {
"type":"string",
"arg.properties":{
"options":["MALE","FEMALE","OTHER"]
}
}
}
]}
在检查版本时,它仍然选择“io.confluent.ksql.avro_模式”-
curl”http://localhost:8081/subjects/test-用户值/版本/1“
{“subject”:“test user value”,“version”:1,“id”:4,“schema”:“{“type”:“record”,“name”:“KsqlDataSourceSchema”,“namespace”:“io.confluent.ksql.avro_schemas”,“fields”:[{“name”:“registertime”,“type”:[“null”,“long”],“default”:null},{“name”:“userid”,“type”:[“null”,“string”],“default默认值:null},{“名称”:“性别”,“类型”:[“null”,“字符串”],“默认值”:null}]}
尝试使用Kafka streams API时出现以下错误-
线程中的异常
“PageView-Users-Stream-Join-eg-1DC61A03-c9d9-4c1e-b5eb-910e4bc74826-StreamThread-1”
org.apache.kafka.streams.errors.StreamsException:反序列化
异常处理程序设置为在出现反序列化错误时失败。如果你
希望流媒体管道在一段时间后继续
反序列化错误,请设置
default.deserialization.exception.handler。在
org.apache.kafka.streams.processor.internals.RecordDeserializer.deserialize(RecordDeserializer.java:80)
在
org.apache.kafka.streams.processor.internals.RecordQueue.maybeUpdateTimestamp(RecordQueue.java:160)
在
org.apache.kafka.streams.processor.internals.RecordQueue.addRawRecords(RecordQueue.java:101)
在
org.apache.kafka.streams.processor.internals.PartitionGroup.addRawRecords(PartitionGroup.java:124)
在
org.apache.kafka.streams.processor.internals.StreamTask.addRecords(StreamTask.java:711)
在
org.apache.kafka.streams.processor.internals.StreamThread.addRecordsToTasks(StreamThread.java:995)
在
org.apache.kafka.streams.processor.internals.StreamThread.runOnce(StreamThread.java:833)
在
org.apache.kafka.streams.processor.internals.StreamThread.runLoop(StreamThread.java:777)
在
org.apache.kafka.streams.processor.internals.StreamThread.run(StreamThread.java:747)
原因:org.apache.kafka.common.errors.SerializationException:
反序列化id 4的Avro消息时出错,原因是:
org.apache.kafka.common.errors.SerializationException:找不到
class io.confluent.ksql.avro_schemas.KsqlDataSourceSchema在为
具体记录。
回答
Datagen始终将名称空间定义为io.confluent.ksql.avro_schemas
。看
现在也有很多方法可以将测试数据生成到卡夫卡中