Skip to main content

Introduction

Dekaf is a high-performance, pure C# Apache Kafka client for .NET. The name is a play on "decaf".

Why Build Another Kafka Client?​

Unlike libraries that wrap librdkafka (a C library), Dekaf is pure C# from the wire protocol to the API:

  • No native dependencies—it runs anywhere .NET runs
  • Zero-allocation hot paths—we use Span<T>, ref struct, and object pooling throughout
  • Full debuggability—when something breaks, you stay in C# land
  • Modern API—built for how we actually write .NET code in 2024

What You Get​

Performance Without Compromise​

We sweat the details so you don't have to:

  • Span<T> and ref struct keep allocations out of hot paths
  • Object pooling for anything we can't avoid allocating
  • ValueTask where operations might complete synchronously
  • Channel-based batching for efficient message handling

Modern .NET, Not Legacy Patterns​

We use the same patterns you're using in your own code:

  • Nullable reference types (no more guessing what can be null)
  • IAsyncEnumerable<T> for streaming consumption
  • KafkaClient root objects when producers, consumers, and admin clients should share connections and memory budgeting
  • ConfigureAwait(false) everywhere (we're a library, we know the rules)
  • Fluent builders that guide you to valid configurations

Full Kafka Protocol Support​

Everything you'd expect from a production Kafka client:

  • Producer with acks, batching, and compression
  • Consumer groups with automatic rebalancing
  • Share groups (KIP-932) for queue-style consumption with per-record acknowledgement
  • Manual partition assignment when you need control
  • Transactions and exactly-once semantics
  • Idempotent producers
  • All the compression codecs (LZ4, Zstd, Snappy, Gzip)

Batteries Included for Real Services​

Most consumers live inside an ASP.NET Core or Worker Service app, so Dekaf ships the service plumbing too:

  • Hosted consumer services — write one ProcessAsync override, get the consume loop, graceful shutdown, and final offset commit for free
  • Failure handling built in: in-place retries, tiered retry topics, and dead letter queues
  • Transactional outbox — at-least-once database-to-Kafka publishing with ordered submission: write the message in the same transaction as your business data, and a background relay delivers it. Partial publish failures can change consumer-observed order; see the ordering contract.
  • Dependency injection with appsettings.json binding, keyed clients, and global interceptors
  • Aspire integrations — a Kafka broker with share groups and a Schema Registry for the AppHost, plus client registrations with health checks and telemetry
  • OpenTelemetry observability — traces with W3C context propagation and OTel semantic-convention metrics, one line to enable

Is Dekaf Right for You?​

Dekaf makes sense if you:

  • Want a pure .NET solution (no native DLLs to wrangle)
  • Care about predictable performance and low GC pressure
  • Like modern C# APIs (async streams, nullable references, etc.)
  • Target .NET 8 or .NET 10 (the core packages also ship netstandard2.0 assets; see API and Runtime Compatibility)

Getting Help​

Ready to get started? Head to the Getting Started guide.