i want To build an audit log for tracking user activity using Kafka Connect CDC (Change Data Capture)
and MySQL
, and set a custom GTID (Global Transaction Identifier) before each transaction, here’s a high-level design pattern and implementation strategy.
Overview of the Solution:
CDC with Kafka Connect: i will use Debezium (a Kafka Connect connector) to capture changes in my MySQL database, which will be streamed to Kafka topics. This will act as the foundation for my audit log system.
Custom GTID: (Global Transaction ID): Before executing each transaction in my application, i will set the GTID with custom information (e.g., tenant ID, email, UUID). This GTID will help me uniquely identify the transaction and associate it with a specific tenant and action. SET gtid_next = 'tenantId:tenantEmail;randomUUID'
Audit Log Consumer: Kafka consumers will read changes from the Kafka topics, process the audit log information (including the GTID), and store the logs in a database or external system.
what re the down side of this approach could issue with replactions?