This article gives a brief introduction of custom codecs in KaDeck Professional and KaDeck Enterprise and covers the essential steps to get you up and running quickly.
It is recommended reading Structure of Codecs before starting developing your own codec as it covers some characteristics and considerations, especially for KaDeck Enterprise users.
Definition of Codec
Codecs are a powerful feature in KaDeck as they allow for not only decoding and encoding custom data formats but also integration of additional (web) services.
A codec consists of a decoding part for data consumption and an optional encoding part for data ingestion. Thus a codec is used in two ways:
- Decode the record's byte array into a JSON value, which will be displayed to the user.
- Encode a JSON value to a byte array for data ingestion.
Though KaDeck includes various codecs for data consumption and data ingestion purpose, it might be necessary to implement custom codecs for specific data types, especially if third-party services need to be integrated, such as a central data structure storage.
A custom codec is implemented using Java 8 and a set of interfaces and classes published by Xeotek.
The code must be compiled using Java 8 and packaged as a jar file. KaDeck will look for jars in the custom codec path, which can be configured in the settings, and load every class implementing the RecordCodec interface.
It is essential to use your own (company's) package name when developing your custom codec and leaving the classes and interfaces provided by Xeotek untouched in their package com.xeotek.kadeck.codec.
We recommend using the reverse domain name notation for your package and adding "Custom" in front of your codecs class name. This will not affect the name that is displayed to the user.
Please do not include any logging libraries and libraries that are published by the Apache Kafka project in your jar file.
Maven Example Project
To get up and running quickly, we have published a custom codec example project which you can find in our Xeotek Gitlab repository. Use git to clone the project and build your custom codec.
The demo project contains a codec implementation that prints all server connections of all users that are being made instead of decoding record data to show how state can be shared across users and instances, which is important for KaDeck Enterprise developers. This can be used for implementing a shared cache.
KaDeck Professional developers do need to focus on the decoding and encoding methods only as there is naturally only one user and one instance of the codec at any given time.
Read our article Custom Codec Maven Project to get started using the custom codec maven project.