简体   繁体   English

JDBC 接收器连接器 - 使用 kafka-connect 从多个主题中插入多个表 - 跟进

[英]JDBC Sink Connector -upserting into multiple tables from multiples topics using kafka-connect - Follow up

This is related to the topic mentioned in the below thread这与以下线程中提到的主题有关

JDBC Sink Connector -upserting into multiple tables from multiples topics using kafka-connect JDBC 接收器连接器 - 使用 kafka-connect 从多个主题插入多个表

I know its a bit older post.我知道它有点旧的帖子。 But my question is also around the same topic.但我的问题也是围绕同一个话题。 The difference is I want to remove the suffix from the topic name and pass the remaining string as the table name in the sink connector.不同之处在于我想从主题名称中删除后缀,并将剩余的字符串作为接收器连接器中的表名传递。 How can I achieve that?我怎样才能做到这一点?

If it is using SMT, can you please help to achieve that.如果它使用 SMT,请您帮忙实现。

Topic Name: Source1-Emp,Source1-Company主题名称:Source1-Emp,Source1-Company

Table Name: Emp, Company表名: Emp, Company

Data load needs to happen from multiple topics to multiple tables using a single sink connector.数据加载需要使用单个接收器连接器从多个主题到多个表。

Can you please help me to implement that.你能帮我实现它吗?

MUS

You're right in your assumption that this can be done with Single Message Transform (SMT).您的假设是正确的,这可以通过单消息转换 (SMT) 来完成。 Here's an example:这是一个例子:

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":"$1"
    }'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 kafka-connect 从多个主题更新到多个表 - Upserting into multiple tables from multiples topics using kafka-connect kafka在接收器连接器属性中连接多个主题 - kafka connect multiple topics in sink connector properties 当接收器启动时,如何使Kafka接收器连接器能够将主题中的数据插入表中 - How to enable Kafka sink connector to insert data from topics to tables as and when sink is up Kafka连接接收器连接器与多个分区主题 - Kafka connect sink connector with multiple one partitioned topics Kafka Connect JDBC接收器连接器 - Kafka Connect JDBC Sink Connector Kafka Connect:如何使用hdfs sink连接器将Kafka主题的protobuf数据发送到HDFS? - Kafka Connect: How can I send protobuf data from Kafka topics to HDFS using hdfs sink connector? Kafka 连接 JDBC 接收器连接器 - 没有主键的表 - Kafka connect JDBC sink connector - tables without Primary Key 无法使用 elasticsearch sink 连接器(kafka-connect) - Unable to use elasticsearch sink connector (kafka-connect) kafka-connect:连接器接收器cassandra的分布式配置出错 - kafka-connect : Getting error in distributed configuration for connector sink cassandra 如何在 JDBC Sink Connector 配置中添加多个主题并获取多个目标表中的主题数据? - How to add multiple topics in JDBC Sink Connector configuration and get topics data in multiple target tables?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM