Itmo.Dev.Platform.Kafka 2.0.86

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Itmo.Dev.Platform.Kafka --version 2.0.86
                    
NuGet\Install-Package Itmo.Dev.Platform.Kafka -Version 2.0.86
                    
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="Itmo.Dev.Platform.Kafka" Version="2.0.86" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Itmo.Dev.Platform.Kafka" Version="2.0.86" />
                    
Directory.Packages.props
<PackageReference Include="Itmo.Dev.Platform.Kafka" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Itmo.Dev.Platform.Kafka --version 2.0.86
                    
#r "nuget: Itmo.Dev.Platform.Kafka, 2.0.86"
                    
#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.
#:package Itmo.Dev.Platform.Kafka@2.0.86
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Itmo.Dev.Platform.Kafka&version=2.0.86
                    
Install as a Cake Addin
#tool nuget:?package=Itmo.Dev.Platform.Kafka&version=2.0.86
                    
Install as a Cake Tool

Itmo.Dev.Platform.Kafka

Platform extensions for working with Kafka

Consumer

Implement message handler

public class MyMessageHandler : IKafkaMessageHandler<int, string>
{
    public ValueTask HandleAsync(
        IEnumerable<ConsumerKafkaMessage<TKey, TValue>> messages, 
        CancellationToken cancellationToken)
    {
        foreach (var message in messages)
        {
            Console.WriteLine($"Received message, Key = {message.Key}, Value = {message.Value}");
        }
        
        return ValueTask.CompletedTask;
    }
}

Implement configuration type

public class Configuration : IKafkaConsumerConfiguration
{
    public bool IsDisabled { get; init; }

    public TimeSpan DisabledConsumerTimeout { get; init; }

    public string Host { get; set; } = string.Empty;

    public string Topic { get; init; } = string.Empty;

    public string Group { get; init; } = string.Empty;

    public int ParallelismDegree { get; init; }

    public int BufferSize { get; init; }

    public TimeSpan BufferWaitLimit { get; init; }

    public bool ReadLatest { get; init; }
}

At runtime, configuration would be received as IOptionsMonitor<TConfiguration>, so you should manually register it to DI container as options.

Add consumer to your ASP.NET server services

Consumer requires an ASP.NET host, as it is implemented as hosted service

Use extension methods to register your consumer.

collection.AddKafkaConsumer<int, string>(builder => builder
    .HandleWith<MyMessageHandler>()
    .DeserializeKeyWithNewtonsoft()
    .DeserializeValueWithNewtonsoft()
    .UseConfiguration<Configuration>());

If you want to use custom deserializer, you can call DeserializeKeyWith<T> where T : IDeserializer<T> method, same way with value deserialization.

If your topic model is defined as protobuf, you can call DeserializeKeyWithProto extension method, same way with value deserialization.

Producer

Add producer to your service collection

collection.AddKafkaProducer<int, string>(builder => builder
    .SerializeKeyWithNewtonsoft()
    .SerializeValueWithNewtonsoft()
    .UseConfiguration<Configuration>());

You can use protobuf serialization same way as it is with consumer.

Resolve producer instance from service provider

var producer = provider.GetRequiredService<IKafkaMessageProducer<int, string>>();
await producer.ProduceAsync(messages, default);
Product Compatible and additional computed target framework versions.
.NET 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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.3.312 116 10/16/2025
2.3.308 161 10/9/2025
2.3.302 157 10/9/2025
2.3.298 161 10/5/2025
2.3.296 153 10/5/2025
2.3.294 213 5/28/2025
2.3.292 194 5/27/2025
2.3.290 219 5/27/2025
2.3.288 170 5/17/2025
2.3.282 267 5/11/2025
2.3.275 110 5/10/2025
2.3.271 126 5/10/2025
2.3.269 114 5/10/2025
2.3.261 227 2/16/2025
2.3.255 155 2/6/2025
2.3.251 176 2/3/2025
2.3.247 475 12/24/2024
2.3.237 216 11/30/2024
2.2.234 235 11/18/2024
2.2.232 146 11/18/2024
2.2.228 149 10/31/2024
2.2.206 230 10/30/2024
2.2.204 195 10/29/2024
2.2.202 153 10/29/2024
2.1.196 146 10/29/2024
2.1.193 171 10/29/2024
2.1.190 157 10/26/2024
2.0.174 143 10/25/2024
2.0.133 145 10/25/2024
2.0.132 142 10/24/2024
2.0.131 206 10/24/2024
2.0.130 158 10/24/2024
2.0.129 174 10/24/2024
2.0.128 151 10/24/2024
2.0.127 149 10/23/2024
2.0.126 155 10/11/2024
2.0.125 164 10/11/2024
2.0.124 145 10/11/2024
2.0.123 160 10/11/2024
2.0.122 169 10/11/2024
2.0.121 147 10/11/2024
2.0.120 166 10/11/2024
2.0.119 160 10/11/2024
2.0.118 180 10/11/2024
2.0.117 149 10/10/2024
2.0.115 160 10/10/2024
2.0.113 162 10/6/2024
2.0.112 206 8/22/2024
2.0.111 216 5/14/2024
2.0.110 182 5/13/2024
2.0.109 180 5/13/2024
2.0.108 216 5/6/2024
2.0.107 191 5/6/2024
2.0.106 182 5/6/2024
2.0.105 177 5/4/2024
2.0.102 186 5/4/2024
2.0.101 174 4/26/2024
2.0.100 199 4/22/2024
2.0.99 171 4/21/2024
2.0.98 182 4/21/2024
2.0.97 182 4/19/2024
2.0.96 179 4/18/2024
2.0.95 167 4/18/2024
2.0.94 207 2/13/2024
2.0.93 191 2/10/2024
2.0.91 183 2/10/2024
2.0.90 191 2/10/2024
2.0.89 322 2/3/2024
2.0.86 165 2/1/2024
1.1.85 186 1/30/2024
1.1.83 225 1/27/2024
1.1.82 271 1/5/2024
1.1.81 343 1/3/2024
1.0.80 206 12/30/2023
1.0.79 177 12/30/2023
1.0.78 188 12/30/2023
1.0.77 211 12/28/2023
1.0.76 188 12/27/2023
1.0.75 228 12/9/2023
1.0.73 211 11/30/2023
1.0.72 181 11/27/2023
1.0.71 201 11/27/2023
1.0.70 200 11/27/2023
1.0.69 159 11/27/2023
1.0.67 191 11/25/2023
1.0.66 173 11/25/2023
1.0.65 178 11/23/2023
1.0.64 160 11/23/2023
1.0.62 191 11/18/2023
1.0.61 196 11/18/2023
1.0.60 167 11/17/2023
1.0.59 170 11/16/2023
1.0.58 171 11/13/2023
1.0.57 159 11/12/2023
1.0.56 167 11/12/2023
1.0.54 195 11/7/2023
1.0.53 186 11/4/2023
1.0.52 205 10/29/2023
1.0.51 184 10/29/2023
1.0.50 196 10/29/2023
1.0.48 188 10/29/2023

Added ssl/sasl configuration