Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

C# Apache Kafka client

License

NotificationsYou must be signed in to change notification settings

ah-/rdkafka-dotnet

Repository files navigation

Please update toConfluent.Kafka.

rdkafka-dotnet - C# Apache Kafka client

Travis Build StatusAppveyor Build StatusGitter chat

Copyright (c) 2015-2016,Andreas Heider

rdkafka-dotnet is a C# client forApache Kafka based onlibrdkafka.

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

Usage

Just reference theRdKafka NuGet package

Examples

Producing messages

using(Producerproducer=newProducer("127.0.0.1:9092"))using(Topictopic=producer.Topic("testtopic")){byte[]data=Encoding.UTF8.GetBytes("Hello RdKafka");DeliveryReportdeliveryReport=awaittopic.Produce(data);Console.WriteLine($"Produced to Partition:{deliveryReport.Partition}, Offset:{deliveryReport.Offset}");}

Consuming messages

varconfig=newConfig(){GroupId="example-csharp-consumer"};using(varconsumer=newEventConsumer(config,"127.0.0.1:9092")){consumer.OnMessage+=(obj,msg)=>{stringtext=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

Seeexamples/

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.

About

C# Apache Kafka client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors9

Languages


[8]ページ先頭

©2009-2025 Movatter.jp