This article will guide you through building a custom codec by using the custom codec project and using it in Kadeck. In the end, you will have a new codec option in your "Codecs" dialog in the data browser of Kadeck.
Introduction
To make it easy to implement a custom code, we have created a custom codec example repository, which you can clone using your favorite git client or git command-line tools.
Note: you need to have git and maven installed to follow this article and build a custom codec.
Clone and build
Go to our repository and click on "clone" in the top right.
Clone our repository using the git command line in the directory of your choice:
- git clone https://gitlab.com/xeotekgit/kadeck-custom-codecs.git
After the last operation has completed, a new directory is created. Go to the new directory (should be "kadeck-custom-codecs") and execute the maven command with the package goal.
Maven will compile and package the custom codec and create a Java Archive (.jar) inside the project's target folder. The file name should be similar to my-codec-1.0-SNAPSHOT-jar-with-dependencies.jar.
Place this file into an empty folder that can be accessed by Kadeck.
Configuring Kadeck
To make the codec available to Kadeck, we need to specify the location of the custom codec.
Go to the settings page and enter the path to the folder, where the .jar file of the custom codec is located and click "Save".
After connecting to a server, go to the record browser screen and select a topic. Click on the "Codec" button in the record list's main menu and select the new codec ("custom codec").
Instead of decoded values, you will see a history consisting of the servers that you have connected to since starting Kadeck, which might be just one entry at the moment.
When connecting to a different or the same server again in the server browser and using the custom codec again, you will see that a new entry was added. Though this might not be a useful functionality of a codec, this demo shows how to maintain and share state between custom codecs, especially when using Kadeck Teams.
Next steps
If you haven't done so already, please read our other articles in this section.
Also, read the comprehensive java doc of the classes and interfaces inside the com.xeotek.kadeck.codec package.
Note that you must not change the objects inside the com.xeotek.kadeck.codec package.
Delete or rename the example class com.mycompany.codec.Codec and write your own custom codec. Don't forget to change the name of the codec and the project and rename the package as well. After you are done, package your codec using maven and put the Java Archive inside your custom codecs folder.