This is the net core versions of the library kafka-net
Use .NET CLI
dotnet add package kafka-net-core --version 1.0.2
var options = new KafkaOptions(new Uri("http://localhost:9092"));
var router = new BrokerRouter(options);
using (Producer client = new Producer(router))
{
client.SendMessageAsync("test_topic", new[] { new Message("hello world") }).Wait();
}
var options = new KafkaOptions(new Uri("http://localhost:9092"));
var router = new BrokerRouter(options);
using (var consumer = new Consumer(new ConsumerOptions("test_topic", router)))
{
// Consume returns a blocking IEnumerable (ie: never ending stream)
foreach (var message in consumer.Consume())
{
Console.WriteLine("Response: P{0},O{1} : {2}",
message.Meta.PartitionId, message.Meta.Offset, message.Value);
}
}