我正在阅读包含Avro消息的Kafka主题。我已经给出了以下架构。我无法解析架构并反序列化消息。
{"type": "record",
"name": "Request",
"namespace": "com.sk.avro.model",
"fields": [
{
"name": "jobId",
"type": [
"null",
"string"
],
"default": null,
"description": "REQUIRED "
},
{
"name": "businessUnit",
"type": "com.example.BusinessUnit",
"default": "ABC",
"description": "Business id"
}
}
我遇到错误:
The type of the "businessUnit" field must be a defined name or a {"type": ...} expression
任何人都可以帮忙。
怎么样
{
"name": "businessUnit",
"type": {
"type ": {
"type ": "record ",
"name ": "BusinessUnit ",
"fields ": [{
"name ": "hostName ",
"type ": "string "
}]
}
}
}