Skip to main content
Version: v2.0.0

Canal (MySQL CDC) connector

Audience: operators bridging EventMesh with Canal (MySQL CDC). MySQL change-data-capture via a deployed canal server. Source consumes binlog entries over the canal TCP protocol (batch ack only after EventMesh accepted the publish); sink replays row-change CloudEvents into a target MySQL as one all-or-nothing JDBC batch.


Classes

DirectionClassBehavior
Sourceorg.apache.eventmesh.connector.canal.source.CanalSourceConnectorCanalConnector.getWithoutAck(batchSize) each poll; ROWDATA entries become CloudEvents (subject = logfile:offset position). commit() acks the pending batch — at-least-once.
Sinkorg.apache.eventmesh.connector.canal.sink.CanalSinkConnectorExecutes each event's SQL (subject) in a single JDBC transaction; any failure rolls back and throws → no ACK → redelivery.

Source configuration

KeyDefaultDescription
connector.canalHostlocalhostCanal server host
connector.canalPort11111Canal server port
connector.destinationexampleCanal destination (instance)
connector.username``Canal auth username
connector.password``Canal auth password
connector.subscribeFilter.*\..*Binlog subscription filter (db.table regex)
connector.batchSize100Max entries per canal batch
connector.pollTimeoutMs1000Poll interval in ms

Sink configuration

KeyDefaultDescription
connector.jdbcUrljdbc:mysql://localhost:3306/testTarget MySQL JDBC URL
connector.dbUserrootDatabase user
connector.dbPassword``Database password

Running

bin/start-connector.sh with -Dconnector.class=...CanalSourceConnector -Dconnector.mode=source -Dconnector.canalHost=canal -Dconnector.destination=example -Dconnector.subscribeFilter=mydb\\..*