Skip to content

Latest commit

 

History

History
39 lines (33 loc) · 1.2 KB

README.md

File metadata and controls

39 lines (33 loc) · 1.2 KB

Misakai.Kafka

High-Performance C# client for Apache Kafka. This client was designed not to support all possibile features, but to serve as a minimalistic and lightweight Kafka client for long-running producers/consumers. The code was based on James Roland's KafkaNet implementation, trimmed down and optimized significantly.

  • Build Status: Build status
  • NuGet Package: Misakai.Kafka

Examples

Producer
var options = new KafkaOptions(new Uri("http://kafka1:9092"), new Uri("http://kafka2:9092"))
{
    Log = new ConsoleLog()
};
var router = new BrokerRouter(options);
var client = new Producer(router);

Task.Run(() =>
{
    var consumer = new Consumer(new ConsumerOptions("latencies", router));
    foreach (var data in consumer.Consume())
    {
       // ... process each message
    }
});

while (true)
{
    client.SendMessageAsync("latencies", new[] {
        "message"
    });
    Thread.Sleep(1);
}

client.Dispose();
router.Dispose();