'Make A custom transform for kafka cdc and Debezium
I'm trying to create a custom transform for Kafka CDC.I want running a replication between MySQL and MongoDB. I prefer when a row update/insert in MySQL database the records the related to that row (A hierarchy tree structure) corresponding complex JSON document(a hierarchy JSON document) update/insert in MongoDB. Can I implement custom transform for Debezium?
Solution 1:[1]
A custom transform for Debezium is no different from a custom SMT for Connect framework, ignoring the defined scehma of the Debezium event.
- Create a Java project with a dependency on at least
org.apache.kafka: connect-transforms - Implement the
Transformationinterface.- Ideally, add unit tests for this as well
- You can look into the Kafka source code for how existing ones are implemented.
- Package it as a JAR. If it needs external dependencies, a shaded JAR will work as long as you relocate any packages that Kafka itself will have on its classpath. For any of those, you should ensure
providedscope; for example,kafka-clientsorjackson-related libraries. - Copy the JAR into a directory listed on the
plugin.pathof the connect worker(s) configs.
https://docs.confluent.io/platform/current/connect/transforms/custom.html
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
