【发布时间】:2020-12-29 22:22:43
【问题描述】:
我正在使用数据库源连接器将数据从我的 Postgres 数据库表移动到 Kafka 主题。我有一个订单表,其中包含使用 customerNumber 字段的客户表的外键。
下面是将订单复制到 Kafka 但没有客户数据到 JSON 的连接器。我正在研究如何将客户订单的完整对象构造成 JSON。
连接器是:
{
"name": "SOURCE_CONNECTOR",
"config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
"transforms.createKey.type": "org.apache.kafka.connect.transforms.ValueToKey",
"connection.password": "postgres_pwd",
"transforms.cast.type": "org.apache.kafka.connect.transforms.Cast$Value",
"transforms.cast.spec": "amount:float64",
"tasks.max": "1",
"transforms": "cast,createKey,extractInt",
"transforms.extractInt.type": "org.apache.kafka.connect.transforms.ExtractField$Key",
"batch.max.rows": "25",
"table.whitelist": "orders",
"mode": "bulk",
"topic.prefix": "data_",
"transforms.extractInt.field": "uuid",
"connection.user": "postgres_user",
"transforms.createKey.fields": "uuid",
"poll.interval.ms": "3600000",
"sql.quote.identifiers": "false",
"name": "SOURCE_CONNECTOR",
"numeric.mapping": "best_fit",
"connection.url": "url"
}
}
【问题讨论】:
标签: jdbc apache-kafka apache-kafka-connect confluent-platform