You can create a Kafka custom operation processor (KCOP) that works with the CDC Replication Engine for Kafka on Linux® and UNIX by developing a Java™ class.
About this task
You can modify the integrated KCOPs that are provided with the CDC Replication Engine for Kafka to suit your needs or
use them as samples to create user-defined KCOPs. A KCOP must implement the
KafkaCustomOperationProcessorIF interface. For more information on the interface, see the API reference in Javadoc format that is installed with the CDC Replication Engine for Kafka.
Procedure
-
Extract the samples.jar file into the lib directory
in your CDC Kafka installation directory.
$ cd CDC_Kafka_installation_directory/lib
$ jar xf ../samples/samples.jar
The integrated KCOPs are in
CDC_Kafka_installation_directory/lib/com/datamirror/ts/target/publication/userexit/sample/kafka
-
Find a KCOP to use as a sample. Rename the class and .java file so they do
not match any of the integrated KCOP .java files.
-
Modify the .java file.
-
Compile the user-defined KCOP .java file by using an IBM® SDK, Java Technology Edition, Version 8.
$ javac -classpath "CDC_Kafka_installation_directory/lib/*"
CDC_Kafka_installation_directory/lib/com/datamirror/ts/target/publication/userexit/sample/kafka/user-defined_KCOP.java
-
Confirm that a .class file was created in the same directory where the
user-defined KCOP .java file resides.
$ cd CDC_Kafka_installation_directory/lib/com/datamirror/ts/target/publication/userexit/sample/kafka
Note: The files that you generate from compiling the class must be in a library or folder that is
referenced by the CLASSPATH environment variable.
-
Stop the CDC Replication Engine for Kafka
datastore.
-
Start the CDC Replication Engine for Kafka datastore.
-
Follow steps 1-6 from Enabling integrated Kafka custom operation processors (KCOP).
-
Enter values for the following fields:
- Class Name
- com.datamirror.ts.target.publication.userexit.sample.kafka.user-defined_KCOP
- Parameters
- The parameters are determined by the user-defined KCOP.
-
Click OK.
Note: Adding libraries to the CLASSPATH variable that conflict with libraries that are provided with
the CDC Replication Engine for Kafka is not
supported.