我正在使用Kafka Connect将数据从MS SQL Server表导入到Apache Kafka主题。
更改列是一个 json 数组,我想将其平面化并发送多个事件。
表记录如下所示:
id table change
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 dbo.Pets {"change":[{"OP":"UPDATE", "Id":"3", "Name":"Rufus","Type":"Cat","Number":"10482638"}, {"OP":"INSERT", "Id":"", "Name":"Misifu","Type":"Reddy","Number":"85745874"}]}
我喜欢在主题中插入的是:
id table change
-------------------------------------------------------------------------------------------------
3 dbo.Pets {"OP":"UPDATE", "Id":"3", "Name":"Rufus","Type":"Cat","Number":"10482638"}
3 dbo.Pets {"OP":"INSERT", "Id":"", "Name":"Misifu","Type":"Reddy","Number":"85745874"}
有人可以帮助我吗?非常感谢:)
解决方案是将消息分解为具有适当格式的 sql 触发器,没有其他选择。感谢大家:)