Custom Single Message Transform fro Debezium that replaces all occurrences of the Unicode character \u0000
(or its equivalent in hexadecimal, \0x00
) with nothing in the specified fields of a Struct record.
The SMT is written in Java and packaged using Maven, so ensure these are installed when working with this package.
brew install java
brew install maven
To deploy the SMT for usage in our Debezium connectors we need to package it up and update the connector plugins.
- Update the package version in
pom.xml
- Run
make build
- this will create the jar in thetarget
directory - Create a new release in the Github repo - name and tag it the version number of the new package
- Upload the newly created jar file to the release
- In your terminal, create a sha512sum for the jar by running
shasum -a 512 <path-to-jar-file>
- In the strimzi-kafka-connect-cluster release in K8s, update the plugin with the new link to the jar file from the Github release and the sha512sum generated above
- Deploy K8s and it will now be using the updated SMT
To use this transform in a Kafka Connect sink connector, you can specify the transforms and transforms.stripNullChars.type
properties in the connector configuration file, like so:
transforms=stripNullChars
transforms.stripNullChars.type=io.github.residentadvisor.strip_unicode_null_transform.StripUnicodeNullTransform
The tests are written in src/test
. It is recommended to use the Test Runner for Java VS Code extension to run the tests.