处理MySQL中多个表的单个KAFKA主题消息

发布于 2025-02-10 03:31:48 字数 478 浏览 2 评论 0原文

我正在阅读从SFTP连接器到KAFKA主题“ topic1”的CSV文件。 每个记录都包含许多列,这些列需要存储在MySQL数据库中的不同表中。 例如: 每条消息看起来像这样 COL1,COL2,COL3,COL4 我想

  1. 在表1中插入/更新col1和col2。

    :Table1列 - ID,COL1,COL2,TBL2ID

  2. 插入/更新Col3和Col4在表2中。

    :Table2列 - ID,COL3,COL4

插入过程中每个表中的ID字段是自动生成的。但是对于更新的情况,我需要参考“ COL1”以获取ID值。

使用mySQLCDC连接器,我可以在kafka主题中同步table1和table2数据,并且可以在ksqldb中引用

我的问题: 是否可以使用KSQLDB处理主题中的每个接收消息,以便我可以分开并将其放入不同的主题中,并可以使用接收器连接器写入MySQL表。

I am reading a CSV file from SFTP Connector to Kafka topic ‘Topic1’.
Each record contains a number of columns which need to be stored into different tables in MySql database.
For example:
Each message can look like this
Col1 , Col2, Col3, Col4
I would like to

  1. Insert/Update Col1 and Col2 in Table1.

    : Table1 columns - Id, Col1 , Col2, Tbl2Id

  2. Insert/Update Col3 and Col4 in Table2.

    : Table2 columns - Id, Col3 , Col4

The Id fields in each table are auto generated during insertion. But for update cases I need to refer to ‘Col1’ to get Id value.

Using MySQLCDC connector, I can sync Table1 and Table2 data in my Kafka topics and can refer in KsqlDB

My question is :
Is it possible to use KsqlDB to process each receiving message in topic so that I can separate and put them into different topics and can use Sink Connectors to write to MySql tables.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文