You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by Fisher Xiang <fi...@gmail.com> on 2021/09/17 08:39:02 UTC

flink cdc data stream api sourceRecord解析

Hi,

RT,对于data stream 消费binlog得到的sourceRecord,是一些string类型的struct类型数据,
 请问官方有什么好的办法去解析这些string类型的struct数据吗?使用反射? 目标是解析成Java对象。

附上数据:

SourceRecord{sourcePartition={server=mysql_binlog_source},
sourceOffset={file=mysql-bin.000001, pos=720, row=1, snapshot=true}}
ConnectRecord{topic='mysql_binlog_source.flink_cdc.student',
kafkaPartition=null, key=Struct{id=1},
keySchema=Schema{mysql_binlog_source.flink_cdc.student.Key:STRUCT},
value=Struct{after=Struct{id=1,name=fisher,age=28},source=Struct{version=1.4.1.Final,connector=mysql,name=mysql_binlog_source,ts_ms=0,snapshot=true,db=flink_cdc,table=student,server_id=0,file=mysql-bin.000001,pos=720,row=0},op=c,ts_ms=1631845080195},
valueSchema=Schema{mysql_binlog_source.flink_cdc.student.Envelope:STRUCT},
timestamp=null, headers=ConnectHeaders(headers=)}


BR
Fisher