Need help with rdkafka-dotnet?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

ah-
228 Stars 78 Forks Other 203 Commits 29 Opened issues

Description

C# Apache Kafka client

Services available

!
?

Need anything else?

Contributors list

# 24,961
C#
kafka
librdka...
spotify
170 commits
# 245,686
C#
kafka
.NET
conflue...
2 commits
# 297,642
kafka
.NET
conflue...
c-sharp
1 commit
# 99,991
C#
kafka
.NET
conflue...
1 commit
# 283,541
F#
.NET
kafka
conflue...
1 commit
# 53,764
notepad
Nim
youtube...
Docker
1 commit
# 3,156
sass-fr...
splash
Socket....
pipelin...
1 commit
# 156,876
C#
signalr
asp
c-sharp
1 commit
# 64,057
F#
entity-...
dotnet-...
xunit
1 commit

This project has moved to https://github.com/confluentinc/confluent-kafka-dotnet and is now being maintained by Confluent

Please update to Confluent.Kafka.

rdkafka-dotnet - C# Apache Kafka client

Travis Build Status Appveyor Build Status Gitter chat

Copyright (c) 2015-2016, Andreas Heider

rdkafka-dotnet is a C# client for Apache Kafka based on librdkafka.

rdkafka-dotnet is licensed under the 2-clause BSD license.

Usage

Just reference the RdKafka NuGet package

Examples

Producing messages

using (Producer producer = new Producer("127.0.0.1:9092"))
using (Topic topic = producer.Topic("testtopic"))
{
    byte[] data = Encoding.UTF8.GetBytes("Hello RdKafka");
    DeliveryReport deliveryReport = await topic.Produce(data);
    Console.WriteLine($"Produced to Partition: {deliveryReport.Partition}, Offset: {deliveryReport.Offset}");
}

Consuming messages

var config = new Config() { GroupId = "example-csharp-consumer" };
using (var consumer = new EventConsumer(config, "127.0.0.1:9092"))
{
    consumer.OnMessage += (obj, msg) =>
    {
        string text = Encoding.UTF8.GetString(msg.Payload, 0, msg.Payload.Length);
        Console.WriteLine($"Topic: {msg.Topic} Partition: {msg.Partition} Offset: {msg.Offset} {text}");
    };

consumer.Subscribe(new []{"testtopic"});
consumer.Start();

Console.WriteLine("Started consumer, press enter to stop consuming");
Console.ReadLine();

}

More

See

examples/

Documentation

Read the API Documentation here

Read the FAQ for answers to common questions

Supported Platforms and .NET Releases

Requires .NET 4.5 or later. Tested with .NET Core on Linux, OS X and Windows, and classic .NET 4.5 on Windows.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.