Skip to main content

Kafka in pure C#,
without librdkafka.

Dekaf is an Apache Kafka client for .NET. Unlike Confluent.Kafka, which wraps the native librdkafka library, it implements the Kafka wire protocol in C#, so there is nothing native to ship and no interop layer to cross.

Start buildingdotnet add package Dekaf

Add the package.​

One NuGet package with assets for .NET 10, .NET 8, and .NET Standard 2.0. Nothing native ships with it.

dotnet add package Dekaf

Produce a message.​

Build a producer from a broker address, then await the broker's acknowledgement. Fluent builders guide you to a valid configuration.

Producer.cs
using Dekaf;

await using var producer = await Kafka
.CreateProducer<string, string>()
.WithBootstrapServers("localhost:9092")
.BuildAsync();

await producer.ProduceAsync(
"greetings", "hello", "Hello, Kafka!");

Read it back.​

Join a consumer group and read records as an async stream with await foreach.

Consumer.cs
using Dekaf;

await using var consumer = await Kafka
.CreateConsumer<string, string>()
.WithBootstrapServers("localhost:9092")
.WithGroupId("greeting-reader")
.SubscribeTo("greetings")
.BuildAsync();

await foreach (var message in consumer.ConsumeAsync())
{
Console.WriteLine(message.Value);
}

Keep reading.​

Browse all documentation
Dekaf
100% C# Kafka client
Allocations per messageon the hot path
0 B
librdkafka
Not included
Native libraries
None
P/Invoke interop
None

Less work for the runtime. More room for your messages.​

Spans, pooled buffers, and ValueTask keep allocations off the hot path. Explore the benchmarks and the decisions behind the performance.