Structure of custom codecs

Structure of custom codecs

This article describes the structure and characteristics of codecs in Kadeck Desktop and Kadeck Teams. It is recommended to read this article carefully before developing a custom codec.

The structure of codecs

Codecs can be separated into two different parts:
  1. Decoding (message consumption)
  2. Encoding (message ingestion)
When records are waiting to be decoded, a consumption request is being issued. Analogously an ingestion request is being published when messages are waiting to be encoded.

Features and characteristics

Besides the apparent decoding and encoding functionalities, a codec in Kadeck has some unique characteristics:
  1. Lifecycle methods allow for preparation before the decoding and encoding process and when a new server connection is made. This is useful when integrating other (web) services to gather additional information required for the encoding/decoding process.
  2. Codec configuration objects give access to the details of the server configuration during the initialization and preparation phase.
  3. A custom codec can optionally be included in the Auto-Detection process, which gives the codec the chance to check if it is applicable for the decoding request. 


A codec runs through several states that were designed to give you plenty of options even when having to deal with complex scenarios, such as calling a web service to retrieve data structures or doing some more advanced calculations before returning a result to KaDeck. 

The instantiation

A codec is instantiated once a connection to a server in the server browser has been established.
For KaDeck Web developers, it is important to note that:
  1. Every user has their own set of codec instances during the whole session.
  2. When a user connects to a server, the user's codec instances are instantiated.
  3. States (e.g., a cache) can be shared across users using static fields.
The instantiation phase can be used to retrieve data from a remote location and to build up a new or update an existing cache. 

The preparation

When a new consumption or ingestion request is available, the preparation methods are executed. 
There is a separate preparation method for ingestion requests and consumption requests.
These preparation methods should be used to prepare the data needed to decode or encode the records so they can be quickly accessed during the subsequent calls of the decoding or encoding methods, respectively.

The decoding or encoding

After the preparation phase, the decoding or encoding methods are called subsequently for every record of the consumption or ingestion request. 
When the custom codec participates in the auto-detection process, throwing an exception inside the method for the first record skips this codec and marks it as "not applicable". If no exception is thrown and a value is returned, the consumption request will be assigned to the codec.
    • Related Articles

    • Custom Codecs Introduction

      This article gives a brief introduction of custom codecs in Kadeck Desktop and Kadeck Teams and covers the essential steps to get you up and running quickly. It is recommended to read Structure of Codecs before starting developing your own codec as ...
    • Custom Codec Maven Quickstart Project

      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 ...
    • Data Protection Policies and Data Masking

      Data protection is a crucial aspect of business operations, especially when dealing with sensitive information. Kadeck Teams Enterprise is equipped with a Data Protection Policy module that helps you define data protection policies through the ...
    • Release 5

      This article describes the changes of the version 5.x update. Latest image tag: xeotek/kadeck:5.0.7 Activating the new monitoring section can lead to slightly higher memory consumption. A new right is required to access the monitoring section. Learn ...
    • Getting Started

      The Kadeck Team says: Thank you! Kadeck is the result of experienced developers, operations, architects and project managers from the IT field, who were looking for an easier and better way to implement, communicate and operate data streaming ...