MASES.KNet.Serialization.Json 2.6.0

dotnet add package MASES.KNet.Serialization.Json --version 2.6.0
NuGet\Install-Package MASES.KNet.Serialization.Json -Version 2.6.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MASES.KNet.Serialization.Json" Version="2.6.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MASES.KNet.Serialization.Json --version 2.6.0
#r "nuget: MASES.KNet.Serialization.Json, 2.6.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MASES.KNet.Serialization.Json as a Cake Addin
#addin nuget:?package=MASES.KNet.Serialization.Json&version=2.6.0

// Install MASES.KNet.Serialization.Json as a Cake Tool
#tool nuget:?package=MASES.KNet.Serialization.Json&version=2.6.0

title: Serialization usage of .NET suite for Apache Kafka _description: Describes how to use serialization of .NET suite for Apache Kafka

KNet: Serializer/Deserializer

KNet comes with a base set of serializer and deserializer. Most of them are usable with primitives types (bool, int, etc) and array of bytes.

If the user wants to use structures types there are two ways:

  1. Creates types in Java and reflects them in C#
  2. Creates types in C# and extend the available serializer/deserializer

KNet suite offers some ready made serializer/deserializer usable with the specific APIs (KNetProducer/KNetConsumer).

The current available packages are:

Let consider a type defined like the following one:

public class TestType
{
    public TestType(int i)
    {
        name = description = value = i.ToString();
    }

    public string name;
    public string description;
    public string value;

    public override string ToString()
    {
        return $"name {name} - description {description} - value {value}";
    }
}

To manage it within C#, without create TestType in Java, an user can create:

  • serializer (the body must be updated with the user serializer):
KNetSerDes<TestType> serializer = new KNetSerDes<TestType>((topic, type) => { return new byte[0]; });
  • deserializer (the body must be updated with the user deserializer):
KNetSerDes<TestType> deserializer = new KNetSerDes<TestType>((topic, data) => { return new TestType(0); });

Otherwise the user can use a ready made class like in the following snippet:

KNetSerDes<TestType> serdes = new JsonSerDes<TestType>();

A single JsonSerDes can be used in serialization and deserialization, and produce Json serialized data.

Specific cases

Some kind of serializers extension have specific needs will be listed below.

Avro serializer

The Avro serializer is based on Apache.Avro package. The types managed are:

  • Avro types managed using the Avro library are Avro records which:

NOTE: simple types (the one that have an Apche Kafka default serializer) are not managed and will be refused

MessagePack serializer

The MessagePack serializer is based on MessagePack package. The types managed are:

  • MessagePack types managed using the MessagePack library shall be MessagePack types.

NOTE: simple types (the one that have an Apche Kafka default serializer) are not managed and will be refused

Protobuf serializer

The Protobuf serializer is based on Google.Protobuf package. The types managed are:

  • Protobuf types managed using the Protobuf library shall be messages types which:
    • Shall have a parameterless constructor
    • Shall conform to IMessage<T>

NOTE: simple types (the one that have an Apche Kafka default serializer) are not managed and will be refused

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.6.0 100 3/1/2024
2.5.0 82 2/28/2024
2.4.3 90 2/11/2024
2.4.2 87 1/27/2024
2.4.1 84 1/21/2024
2.4.0 74 1/20/2024
2.3.0 179 11/25/2023
2.2.0 122 10/19/2023
2.1.3 265 10/11/2023
2.1.2 261 10/6/2023
2.1.1 245 10/5/2023
2.1.0 152 9/27/2023
2.0.2 170 8/2/2023
2.0.1 154 7/11/2023
2.0.0 151 7/8/2023
1.5.5 149 7/1/2023
1.5.4 133 5/28/2023