JDBC 接收器连接器 - 使用 kafka-connect 从多个主题插入多个表 - 跟进
JDBC Sink Connector -upserting into multiple tables from multiples topics using kafka-connect - Follow up
这与以下线程中提到的主题相关
我知道它有点旧 post。但我的问题也围绕着同一个话题。区别在于我想从主题名称中删除后缀,并将剩余的字符串作为接收器连接器中的 table 名称传递。我怎样才能做到这一点?
如果是用SMT,请帮忙实现一下。
主题名称:Source1-Emp,Source1-Company
Table 姓名:雇员,公司
需要使用单个接收器连接器将数据从多个主题加载到多个 table。
你能帮我实现一下吗?
亩
您认为这可以通过单消息转换 (SMT) 来完成的假设是正确的。这是一个例子:
curl -X PUT http://localhost:8083/connectors/sink-postgres-00/config \
-H "Content-Type: application/json" \
-d '{
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"connection.url": "jdbc:postgresql://postgres:5432/",
"connection.user": "postgres",
"connection.password": "postgres",
"tasks.max": "1",
"topics": "Source1-Emp,Source1-Company",
"auto.create": "true",
"auto.evolve":"true",
"transforms":"dropPrefix",
"transforms.dropPrefix.type":"org.apache.kafka.connect.transforms.RegexRouter",
"transforms.dropPrefix.regex":"Source1-(.*)$",
"transforms.dropPrefix.replacement":""
}'
这与以下线程中提到的主题相关
我知道它有点旧 post。但我的问题也围绕着同一个话题。区别在于我想从主题名称中删除后缀,并将剩余的字符串作为接收器连接器中的 table 名称传递。我怎样才能做到这一点?
如果是用SMT,请帮忙实现一下。
主题名称:Source1-Emp,Source1-Company
Table 姓名:雇员,公司
需要使用单个接收器连接器将数据从多个主题加载到多个 table。
你能帮我实现一下吗?
亩
您认为这可以通过单消息转换 (SMT) 来完成的假设是正确的。这是一个例子:
curl -X PUT http://localhost:8083/connectors/sink-postgres-00/config \
-H "Content-Type: application/json" \
-d '{
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"connection.url": "jdbc:postgresql://postgres:5432/",
"connection.user": "postgres",
"connection.password": "postgres",
"tasks.max": "1",
"topics": "Source1-Emp,Source1-Company",
"auto.create": "true",
"auto.evolve":"true",
"transforms":"dropPrefix",
"transforms.dropPrefix.type":"org.apache.kafka.connect.transforms.RegexRouter",
"transforms.dropPrefix.regex":"Source1-(.*)$",
"transforms.dropPrefix.replacement":""
}'