<commit_before>rdkafka-dotnet - C# Apache Kafka client
=======================================

[![Join the chat at https://gitter.im/ah-/rdkafka-dotnet](https://badges.gitter.im/ah-/rdkafka-dotnet.svg)](https://gitter.im/ah-/rdkafka-dotnet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Travis Build Status](https://travis-ci.org/ah-/rdkafka-dotnet.svg?branch=master)](https://travis-ci.org/ah-/rdkafka-dotnet)
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/github/ah-/rdkafka-dotnet?branch=master&svg=true)](https://ci.appveyor.com/project/ah-/rdkafka-dotnet)

Copyright (c) 2015-2016, [<NAME>](mailto:<EMAIL>)

**rdkafka-dotnet** is a C# client for [Apache Kafka](http://kafka.apache.org/) based on [librdkafka](https://github.com/edenhill/librdkafka).

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

## Usage

Just reference the [RdKafka NuGet package](https://www.nuget.org/packages/RdKafka)

## Examples

### Producing messages

```cs
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

```cs
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](https://ah-.github.io/rdkafka-dotnet/api/RdKafka.html)

[Read the FAQ for answers to common questions](https://github.com/ah-/rdkafka-dotnet/wiki/Faq)

## 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.
<commit_msg>Advertise librdkafka gitter<commit_after>rdkafka-dotnet - C# Apache Kafka client
=======================================

[![Travis Build Status](https://travis-ci.org/ah-/rdkafka-dotnet.svg?branch=master)](https://travis-ci.org/ah-/rdkafka-dotnet)
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/github/ah-/rdkafka-dotnet?branch=master&svg=true)](https://ci.appveyor.com/project/ah-/rdkafka-dotnet)

[![Gitter chat](https://badges.gitter.im/edenhill/librdkafka.png)](https://gitter.im/edenhill/librdkafka)

Copyright (c) 2015-2016, [<NAME>](mailto:<EMAIL>)

**rdkafka-dotnet** is a C# client for [Apache Kafka](http://kafka.apache.org/) based on [librdkafka](https://github.com/edenhill/librdkafka).

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

## Usage

Just reference the [RdKafka NuGet package](https://www.nuget.org/packages/RdKafka)

## Examples

### Producing messages

```cs
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

```cs
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](https://ah-.github.io/rdkafka-dotnet/api/RdKafka.html)

[Read the FAQ for answers to common questions](https://github.com/ah-/rdkafka-dotnet/wiki/Faq)

## 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.

{'fraction_non_alphanumeric': 0.18267132256656482, 'fraction_numerical': 0.01571366215626364, 'mean_word_length': 4.714463840399002, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 21, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2029006', 'n_tokens_mistral': 1649, 'n_tokens_neox': 1572, 'n_words': 313}