文档菜单
文档首页
/
MongoDB Kafka 连接器
/ /

输出格式属性

本页

  • 概述
  • 设置

使用以下配置设置来指定MongoDB Kafka源连接器发布到Kafka主题的数据格式。

有关按类别组织源连接器配置设置的列表,请参阅源连接器配置属性指南.

名称
描述
output.format.key
类型: 字符串

描述
指定源连接器输出键文档的数据格式。

默认值: json
接受值: bson, json, schema
output.format.value
类型: 字符串

描述
指定源连接器输出值文档的数据格式。

连接器支持Protobuf作为输出数据格式。您可以通过指定schema值并安装和配置Kafka Connect Protobuf转换器来启用此格式。Kafka Connect Protobuf转换器.

默认值: json
接受值: bson, json, schema
output.json.formatter
类型: 字符串

描述
连接器输出数据时应使用的JSON格式化程序类名。

默认值:
com.mongodb.kafka.connect.source.json.formatter.DefaultJson
接受值:
您的自定义JSON格式化程序完整类名或以下内置格式化程序类名之一
com.mongodb.kafka.connect.source.json.formatter.DefaultJson
com.mongodb.kafka.connect.source.json.formatter.ExtendedJson
com.mongodb.kafka.connect.source.json.formatter.SimplifiedJson
有关这些输出格式的更多信息,请参阅JSON格式化程序
output.schema.key
类型: 字符串

描述
指定 SourceRecord 的键文档的 Avro 架构定义。

要了解更多关于 Avro 架构的信息,请参阅 Avro数据格式指南 中的内容。

默认值:
{
"type": "record",
"name": "keySchema",
"fields" : [ { "name": "_id", "type": "string" } ]"
}
有效值:有效的 Avro 架构
output.schema.value
类型: 字符串

描述
指定 SourceRecord 的值文档的 Avro 架构定义。

要了解更多关于 Avro 架构的信息,请参阅 Avro数据格式指南 中的内容。

默认值:
{
"name": "ChangeStream",
"type": "record",
"fields": [
{ "name": "_id", "type": "string" },
{ "name": "operationType", "type": ["string", "null"] },
{ "name": "fullDocument", "type": ["string", "null"] },
{ "name": "ns",
"type": [{"name": "ns", "type": "record", "fields": [
{"name": "db", "type": "string"},
{"name": "coll", "type": ["string", "null"] } ]
}, "null" ] },
{ "name": "to",
"type": [{"name": "to", "type": "record", "fields": [
{"name": "db", "type": "string"},
{"name": "coll", "type": ["string", "null"] } ]
}, "null" ] },
{ "name": "documentKey", "type": ["string", "null"] },
{ "name": "updateDescription",
"type": [{"name": "updateDescription", "type": "record", "fields": [
{"name": "updatedFields", "type": ["string", "null"]},
{"name": "removedFields",
"type": [{"type": "array", "items": "string"}, "null"]
}] }, "null"] },
{ "name": "clusterTime", "type": ["string", "null"] },
{ "name": "txnNumber", "type": ["long", "null"]},
{ "name": "lsid", "type": [{"name": "lsid", "type": "record",
"fields": [ {"name": "id", "type": "string"},
{"name": "uid", "type": "string"}] }, "null"] }
]
}
有效值:有效的 JSON 架构
output.schema.infer.value
类型:布尔型

描述
是否应该推断 SourceRecord 的值文档的架构。由于连接器独立处理每个文档,连接器可能会生成多个架构。

重要:连接器仅在将您的 output.format.value 设置为 schema 时读取此设置。

默认值false
有效值truefalse

后退

更改流