odbozhou opened a new issue, #385:
URL: https://github.com/apache/rocketmq-connect/issues/385
在很多情况,发送到RocketMQ
Topic的消息是没有schema信息的,例如大部分业务消息,业务开发者之间一般通过接口文档的方式描述topic中的消息数据格式,这些数据一般是json,下游根据接口文档的描述对topic中的数据解析,转换成类对象。
connector实现是通用的,通过简单的配置化即可使用,如果没有schema信息,sink connector可能很难解析topic中的数据。
但是由于json数据的特殊性,我们可以根据json数据简单的反推数据的schema
例如
{
"id": 10000,
"name": "connector",
"create_datetime": 1501834166000,
"update_timestamp": 1501834166000
}
我们可以推断出对应的schema
{
"schema": {
"type": "struct",
"fields": [{
"type": "int32",
"optional": true,
"field": "id"
}, {
"type": "string",
"optional": true,
"field": "name"
}, {
"type": "int64",
"optional": false,
"name": "org.apache.rocketmq.connect.data.Timestamp",
"version": 1,
"field": "create_datetime"
}, {
"type": "int64",
"optional": false,
"name": "org.apache.rocketmq.connect.data.Timestamp",
"version": 1,
"field": "update_timestamp"
}],
"optional": false,
"name": "user"
},
"payload": {
"id": 10000,
"name": "connector",
"create_datetime": 1501834166000,
"update_timestamp": 1501834166000
}
}
根据上面的例子,基本可以判断
JsonConverter可以通过简单的数据推断出起对应你的schema
推断出schema后对sink connector处理数据是十分有用的
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]