[英]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.