diff --git a/.gitignore b/.gitignore index 30634b94a..583ed2daa 100644 --- a/.gitignore +++ b/.gitignore @@ -6,9 +6,10 @@ obj/ *.csproj.user *.xproj.user .vs +.vscode todo.txt .cache -src/RdKafka/runtimes +src/Confluent.Kafka/runtimes Properties packages/ doc/api/ diff --git a/.travis.yml b/.travis.yml index fac168411..a0a9fac44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -# Origin: https://github.com/ah-/rdkafka-dotnet +# Origin: https://github.com/confluentinc/confluent-kafka-dotnet language: csharp sudo: required @@ -19,6 +19,6 @@ install: - dotnet restore script: - - dotnet build ./src/RdKafka/project.json - - dotnet pack ./src/RdKafka/project.json - - dotnet test ./test/RdKafka.Tests/ + - dotnet build ./src/Confluent.Kafka/project.json + - dotnet pack ./src/Confluent.Kafka/project.json + - dotnet test ./test/Confluent.Kafka.Tests/ diff --git a/RdKafka.sln b/Confluent.Kafka.sln similarity index 93% rename from RdKafka.sln rename to Confluent.Kafka.sln index 6cd31a68d..7bee88455 100644 --- a/RdKafka.sln +++ b/Confluent.Kafka.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RdKafka", "src\RdKafka\RdKafka.xproj", "{B2DDB635-4423-45D7-B3DC-F701E6010868}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Confluent.Kafka", "src\Confluent.Kafka\Confluent.Kafka.xproj", "{B2DDB635-4423-45D7-B3DC-F701E6010868}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RdKafka.Tests", "test\RdKafka.Tests\RdKafka.Tests.xproj", "{33151BE2-C10B-41BC-8C5E-E55211A1722D}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Confluent.Kafka.Tests", "test\Confluent.Kafka.Tests\Confluent.Kafka.Tests.xproj", "{33151BE2-C10B-41BC-8C5E-E55211A1722D}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SimpleProducer", "examples\SimpleProducer\SimpleProducer.xproj", "{A7BF0A75-D3E7-4024-8597-5FCCC567D372}" EndProject diff --git a/README.md b/README.md index 22f7a8aeb..d06e058d3 100644 --- a/README.md +++ b/README.md @@ -1,65 +1,19 @@ -rdkafka-dotnet - C# Apache Kafka client -======================================= +confluent-kafka-dotnet - .NET 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) +**confluent-kafka-dotnet** is a .NET client for [Apache Kafka](http://kafka.apache.org/) based on [librdkafka](https://github.com/edenhill/librdkafka). -Copyright (c) 2015-2016, [Andreas Heider](mailto:andreas@heider.io) +Forked from [rdkafka-net](https://github.com/ah-/rdkafka-dotnet) by Andreas Heider -**rdkafka-dotnet** is a C# client for [Apache Kafka](http://kafka.apache.org/) based on [librdkafka](https://github.com/edenhill/librdkafka). +Copyright (c) 2016 [Confluent Inc.](https://www.confluent.io), 2015-2016, [Andreas Heider](mailto:andreas@heider.io) -**rdkafka-dotnet** is licensed under the 2-clause BSD license. ## Usage -Just reference the [RdKafka NuGet package](https://www.nuget.org/packages/RdKafka) +Just reference the [confluent-kafka-dotnet NuGet package](https://www.nuget.org/packages/confluent-kafka-dotnet) ## 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. diff --git a/appveyor.yml b/appveyor.yml index 06dd7c64f..7d0fb7f02 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,14 +13,14 @@ environment: build_script: - appveyor-retry dotnet restore -v Minimal - dotnet build **/project.json -c %CONFIGURATION% - - cmd: IF "%APPVEYOR_REPO_TAG%" == "true" (dotnet pack src/RdKafka/project.json -c %CONFIGURATION%) - - cmd: IF NOT "%APPVEYOR_REPO_TAG%" == "true" (dotnet pack src/RdKafka/project.json -c %CONFIGURATION% --version-suffix ci-%APPVEYOR_BUILD_NUMBER%) - - dotnet test test/RdKafka.Tests + - cmd: IF "%APPVEYOR_REPO_TAG%" == "true" (dotnet pack src/Confluent.Kafka/project.json -c %CONFIGURATION%) + - cmd: IF NOT "%APPVEYOR_REPO_TAG%" == "true" (dotnet pack src/Confluent.Kafka/project.json -c %CONFIGURATION% --version-suffix ci-%APPVEYOR_BUILD_NUMBER%) + - dotnet test test/Confluent.Kafka.Tests test: off artifacts: - - path: ./src/RdKafka/bin/Release/*.nupkg + - path: ./src/Confluent.Kafka/bin/Release/*.nupkg deploy: provider: NuGet diff --git a/doc/docfx.json b/doc/docfx.json index b97e03e84..20ee7b42e 100644 --- a/doc/docfx.json +++ b/doc/docfx.json @@ -4,7 +4,7 @@ "src": [ { "files": [ - "src/RdKafka/*.cs" + "src/Confluent.Kafka/*.cs" ], "cwd": ".." } @@ -23,7 +23,7 @@ } ], "globalMetadata": { - "_appTitle": "RdKafka", + "_appTitle": "Confluent.Kafka", "_disableContribution": true, "_disableFooter": true }, diff --git a/doc/index.md b/doc/index.md index 6ae102071..8d8349946 100644 --- a/doc/index.md +++ b/doc/index.md @@ -1,47 +1,19 @@ -rdkafka-dotnet - C# Apache Kafka client -======================================= +confluent-kafka-dotnet - .NET Apache Kafka client +================================================= -**rdkafka-dotnet** is a C# client for [Apache Kafka](http://kafka.apache.org/) based on [librdkafka](https://github.com/edenhill/librdkafka). +**confluent-kafka-dotnet** is a .NET client for [Apache Kafka](http://kafka.apache.org/) based on [librdkafka](https://github.com/edenhill/librdkafka). -## Usage +Forked from [rdkafka-net](https://github.com/ah-/rdkafka-dotnet) by Andreas Heider. + +Copyright (c) 2016 [Confluent Inc.](https://www.confluent.io), 2015-2016, [Andreas Heider](mailto:andreas@heider.io) -Just reference the [RdKafka NuGet package](https://www.nuget.org/packages/RdKafka) -## Api Reference +## Usage -[Read the Api Documentation here](api/RdKafka.html) +Just reference the [confluent-kafka-dotnet NuGet package](https://www.nuget.org/packages/confluent-kafka-dotnet) ## 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(); -} -``` +## Documentation + +## Supported Platforms and .NET Releases \ No newline at end of file diff --git a/doc/toc.yml b/doc/toc.yml index f29d5bb75..b317e3467 100644 --- a/doc/toc.yml +++ b/doc/toc.yml @@ -1,3 +1,3 @@ - name: Api reference - href: api/RdKafka.html - homepage: api/RdKafka.yml + href: api/Confluent.Kafka.html + homepage: api/Confluent.Kafka.yml diff --git a/examples/AdvancedConsumer/Program.cs b/examples/AdvancedConsumer/Program.cs index 1a48698bf..fbff3711c 100644 --- a/examples/AdvancedConsumer/Program.cs +++ b/examples/AdvancedConsumer/Program.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using RdKafka; +using Confluent.Kafka; -namespace AdvancedConsumer +namespace Confluent.Kafka.AdvancedConsumer { public class Program { diff --git a/examples/AdvancedConsumer/project.json b/examples/AdvancedConsumer/project.json index 040761467..87c7b89af 100644 --- a/examples/AdvancedConsumer/project.json +++ b/examples/AdvancedConsumer/project.json @@ -1,13 +1,13 @@ { "version": "1.0.0", - "authors": ["Andreas Heider"], + "authors": ["Andreas Heider", "Confluent Inc"], "buildOptions": { "emitEntryPoint": true }, "dependencies": { - "RdKafka": { + "Confluent.Kafka": { "target": "project" } }, diff --git a/examples/AdvancedProducer/Program.cs b/examples/AdvancedProducer/Program.cs index f1d1788d2..c11cf97f9 100644 --- a/examples/AdvancedProducer/Program.cs +++ b/examples/AdvancedProducer/Program.cs @@ -1,9 +1,9 @@ using System; using System.Text; using System.Threading.Tasks; -using RdKafka; +using Confluent.Kafka; -namespace AdvancedProducer +namespace Confluent.Kafka.AdvancedProducer { public class Program { diff --git a/examples/AdvancedProducer/project.json b/examples/AdvancedProducer/project.json index 040761467..87c7b89af 100644 --- a/examples/AdvancedProducer/project.json +++ b/examples/AdvancedProducer/project.json @@ -1,13 +1,13 @@ { "version": "1.0.0", - "authors": ["Andreas Heider"], + "authors": ["Andreas Heider", "Confluent Inc"], "buildOptions": { "emitEntryPoint": true }, "dependencies": { - "RdKafka": { + "Confluent.Kafka": { "target": "project" } }, diff --git a/examples/Benchmark/Program.cs b/examples/Benchmark/Program.cs index 499b4f8fc..109eccbf1 100644 --- a/examples/Benchmark/Program.cs +++ b/examples/Benchmark/Program.cs @@ -5,9 +5,9 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using RdKafka; +using Confluent.Kafka; -namespace Benchmark +namespace Confluent.Kafka.Benchmark { public class Program { @@ -82,7 +82,8 @@ public static void Main(string[] args) string brokerList = args[0]; string topic = args[1]; - long numMessages = 10000000; + long numMessages = 1000000; + var stopwatch = new Stopwatch(); stopwatch.Start(); diff --git a/examples/Benchmark/project.json b/examples/Benchmark/project.json index b572b1f7f..620dec51d 100644 --- a/examples/Benchmark/project.json +++ b/examples/Benchmark/project.json @@ -1,13 +1,13 @@ { "version": "1.0.0", - "authors": ["Andreas Heider"], + "authors": ["Andreas Heider", "Confluent Inc"], "buildOptions": { "emitEntryPoint": true }, "dependencies": { - "RdKafka": { + "Confluent.Kafka": { "target": "project" } }, diff --git a/examples/Misc/Program.cs b/examples/Misc/Program.cs index b0ce3bb17..3f9ad0f1a 100644 --- a/examples/Misc/Program.cs +++ b/examples/Misc/Program.cs @@ -1,9 +1,9 @@ using System; using System.Linq; using System.Threading.Tasks; -using RdKafka; +using Confluent.Kafka; -namespace Misc +namespace Confluent.Kafka.Misc { public class Program { diff --git a/examples/Misc/project.json b/examples/Misc/project.json index 040761467..87c7b89af 100644 --- a/examples/Misc/project.json +++ b/examples/Misc/project.json @@ -1,13 +1,13 @@ { "version": "1.0.0", - "authors": ["Andreas Heider"], + "authors": ["Andreas Heider", "Confluent Inc"], "buildOptions": { "emitEntryPoint": true }, "dependencies": { - "RdKafka": { + "Confluent.Kafka": { "target": "project" } }, diff --git a/examples/SimpleConsumer/Program.cs b/examples/SimpleConsumer/Program.cs index cee0e97c0..2be8a87cd 100644 --- a/examples/SimpleConsumer/Program.cs +++ b/examples/SimpleConsumer/Program.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using RdKafka; +using Confluent.Kafka; -namespace SimpleProducer +namespace Confluent.Kafka.SimpleProducer { public class Program { diff --git a/examples/SimpleConsumer/project.json b/examples/SimpleConsumer/project.json index 040761467..87c7b89af 100644 --- a/examples/SimpleConsumer/project.json +++ b/examples/SimpleConsumer/project.json @@ -1,13 +1,13 @@ { "version": "1.0.0", - "authors": ["Andreas Heider"], + "authors": ["Andreas Heider", "Confluent Inc"], "buildOptions": { "emitEntryPoint": true }, "dependencies": { - "RdKafka": { + "Confluent.Kafka": { "target": "project" } }, diff --git a/examples/SimpleProducer/Program.cs b/examples/SimpleProducer/Program.cs index c8c601f4e..564c3bf7f 100644 --- a/examples/SimpleProducer/Program.cs +++ b/examples/SimpleProducer/Program.cs @@ -1,9 +1,9 @@ using System; using System.Text; using System.Threading.Tasks; -using RdKafka; +using Confluent.Kafka; -namespace SimpleProducer +namespace Confluent.Kafka.SimpleProducer { public class Program { diff --git a/examples/SimpleProducer/project.json b/examples/SimpleProducer/project.json index b572b1f7f..620dec51d 100644 --- a/examples/SimpleProducer/project.json +++ b/examples/SimpleProducer/project.json @@ -1,13 +1,13 @@ { "version": "1.0.0", - "authors": ["Andreas Heider"], + "authors": ["Andreas Heider", "Confluent Inc"], "buildOptions": { "emitEntryPoint": true }, "dependencies": { - "RdKafka": { + "Confluent.Kafka": { "target": "project" } }, diff --git a/src/RdKafka/Config.cs b/src/Confluent.Kafka/Config.cs similarity index 67% rename from src/RdKafka/Config.cs rename to src/Confluent.Kafka/Config.cs index eb0eee441..c7093ac3b 100644 --- a/src/RdKafka/Config.cs +++ b/src/Confluent.Kafka/Config.cs @@ -1,12 +1,11 @@ using System; using System.Collections.Generic; -using RdKafka.Internal; +using Confluent.Kafka.Internal; -namespace RdKafka +namespace Confluent.Kafka { /// - /// Global configuration that is passed to - /// Consumer or Producer constructors. + /// Global configuration that is passed to Consumer or Producer constructors. /// public class Config { @@ -18,14 +17,14 @@ public Config() } /// - /// Dump all configuration names and values into a dictionary. + /// Dump all configuration names and values into a dictionary. /// public Dictionary Dump() => handle.Dump(); /// - /// Get or set a configuration value directly. + /// Get or set a configuration value directly. /// - /// See CONFIGURATION.md for the full list of supported properties. + /// See CONFIGURATION.md for the full list of supported properties. /// /// The configuration property name. /// The configuration property value. @@ -44,9 +43,9 @@ public string this[string name] } /// - /// Client group id string. + /// Client group id string. /// - /// All clients sharing the same group.id belong to the same group. + /// All clients sharing the same group.id belong to the same group. /// > public string GroupId { @@ -55,7 +54,7 @@ public string GroupId } /// - /// Automatically and periodically commit offsets in the background. + /// Automatically and periodically commit offsets in the background. /// > public bool EnableAutoCommit { @@ -65,14 +64,14 @@ public bool EnableAutoCommit public delegate void LogCallback(string handle, int level, string fac, string buf); /// - /// Set custom logger callback. + /// Set custom logger callback. /// - /// By default RdKafka logs using Console.WriteLine. + /// By default Confluent.Kafka logs using Console.WriteLine. /// public LogCallback Logger { get; set; } /// - /// Statistics emit interval for OnStatistics. + /// Statistics emit interval for OnStatistics. /// public TimeSpan StatisticsInterval { @@ -81,8 +80,8 @@ public TimeSpan StatisticsInterval } /// - /// Sets the default topic configuration to use for automatically - /// subscribed topics (e.g., through pattern-matched topics). + /// Sets the default topic configuration to use for automatically subscribed topics + /// (e.g., through pattern-matched topics). /// public TopicConfig DefaultTopicConfig { get; set; } } diff --git a/src/RdKafka/RdKafka.xproj b/src/Confluent.Kafka/Confluent.Kafka.xproj similarity index 95% rename from src/RdKafka/RdKafka.xproj rename to src/Confluent.Kafka/Confluent.Kafka.xproj index 65516bbbd..6646195cc 100644 --- a/src/RdKafka/RdKafka.xproj +++ b/src/Confluent.Kafka/Confluent.Kafka.xproj @@ -7,7 +7,7 @@ b2ddb635-4423-45d7-b3dc-f701e6010868 - RdKafka + Confluent.Kafka .\obj .\bin\ diff --git a/src/RdKafka/Consumer.cs b/src/Confluent.Kafka/Consumer.cs similarity index 99% rename from src/RdKafka/Consumer.cs rename to src/Confluent.Kafka/Consumer.cs index de64aada9..25d636bd3 100644 --- a/src/RdKafka/Consumer.cs +++ b/src/Confluent.Kafka/Consumer.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using RdKafka.Internal; +using Confluent.Kafka.Internal; -namespace RdKafka +namespace Confluent.Kafka { /// /// High-level Kafka Consumer, receives messages from a Kafka cluster. diff --git a/src/RdKafka/ErrorCode.cs b/src/Confluent.Kafka/ErrorCode.cs similarity index 81% rename from src/RdKafka/ErrorCode.cs rename to src/Confluent.Kafka/ErrorCode.cs index 363bb7819..46bc81de3 100644 --- a/src/RdKafka/ErrorCode.cs +++ b/src/Confluent.Kafka/ErrorCode.cs @@ -1,7 +1,10 @@ -namespace RdKafka +namespace Confluent.Kafka { - /// Internal errors to rdkafka are prefixed with _ - public enum ErrorCode { + /// + /// Internal errors to rdkafka are prefixed with _ + /// + public enum ErrorCode + { /// Begin internal error codes _BEGIN = -200, /// Received message is incorrect @@ -37,33 +40,33 @@ public enum ErrorCode { /// Queue is full _QUEUE_FULL = -184, /// ISR count < required.acks - _ISR_INSUFF = -183, + _ISR_INSUFF = -183, /// Broker node update - _NODE_UPDATE = -182, + _NODE_UPDATE = -182, /// SSL error _SSL = -181, /// Waiting for coordinator to become available. - _WAIT_COORD = -180, + _WAIT_COORD = -180, /// Unknown client group - _UNKNOWN_GROUP = -179, + _UNKNOWN_GROUP = -179, /// Operation in progress - _IN_PROGRESS = -178, + _IN_PROGRESS = -178, /// Previous operation in progress, wait for it to finish. - _PREV_IN_PROGRESS = -177, + _PREV_IN_PROGRESS = -177, /// This operation would interfere with an existing subscription - _EXISTING_SUBSCRIPTION = -176, + _EXISTING_SUBSCRIPTION = -176, /// Assigned partitions (rebalance_cb) - _ASSIGN_PARTITIONS = -175, + _ASSIGN_PARTITIONS = -175, /// Revoked partitions (rebalance_cb) - _REVOKE_PARTITIONS = -174, + _REVOKE_PARTITIONS = -174, /// Conflicting use - _CONFLICT = -173, + _CONFLICT = -173, /// Wrong state - _STATE = -172, + _STATE = -172, /// Unknown protocol - _UNKNOWN_PROTOCOL = -171, + _UNKNOWN_PROTOCOL = -171, /// Not implemented - _NOT_IMPLEMENTED = -170, + _NOT_IMPLEMENTED = -170, /// Authentication failure _AUTHENTICATION = -169, /// No stored offset @@ -103,37 +106,37 @@ public enum ErrorCode { /// Broker disconnected before response received NETWORK_EXCEPTION = 13, /// Group coordinator load in progress - GROUP_LOAD_IN_PROGRESS = 14, + GROUP_LOAD_IN_PROGRESS = 14, /// Group coordinator not available - GROUP_COORDINATOR_NOT_AVAILABLE = 15, + GROUP_COORDINATOR_NOT_AVAILABLE = 15, /// Not coordinator for group - NOT_COORDINATOR_FOR_GROUP = 16, + NOT_COORDINATOR_FOR_GROUP = 16, /// Invalid topic - TOPIC_EXCEPTION = 17, + TOPIC_EXCEPTION = 17, /// Message batch larger than configured server segment size - RECORD_LIST_TOO_LARGE = 18, + RECORD_LIST_TOO_LARGE = 18, /// Not enough in-sync replicas - NOT_ENOUGH_REPLICAS = 19, + NOT_ENOUGH_REPLICAS = 19, /// Message(s) written to insufficient number of in-sync replicas - NOT_ENOUGH_REPLICAS_AFTER_APPEND = 20, + NOT_ENOUGH_REPLICAS_AFTER_APPEND = 20, /// Invalid required acks value - INVALID_REQUIRED_ACKS = 21, + INVALID_REQUIRED_ACKS = 21, /// Specified group generation id is not valid - ILLEGAL_GENERATION = 22, + ILLEGAL_GENERATION = 22, /// Inconsistent group protocol - INCONSISTENT_GROUP_PROTOCOL = 23, + INCONSISTENT_GROUP_PROTOCOL = 23, /// Invalid group.id INVALID_GROUP_ID = 24, /// Unknown member - UNKNOWN_MEMBER_ID = 25, + UNKNOWN_MEMBER_ID = 25, /// Invalid session timeout - INVALID_SESSION_TIMEOUT = 26, + INVALID_SESSION_TIMEOUT = 26, /// Group rebalance in progress REBALANCE_IN_PROGRESS = 27, /// Commit offset data size is not valid - INVALID_COMMIT_OFFSET_SIZE = 28, + INVALID_COMMIT_OFFSET_SIZE = 28, /// Topic authorization failed - TOPIC_AUTHORIZATION_FAILED = 29, + TOPIC_AUTHORIZATION_FAILED = 29, /// Group authorization failed GROUP_AUTHORIZATION_FAILED = 30, /// Cluster authorization failed diff --git a/src/RdKafka/EventConsumer.cs b/src/Confluent.Kafka/EventConsumer.cs similarity index 97% rename from src/RdKafka/EventConsumer.cs rename to src/Confluent.Kafka/EventConsumer.cs index 0c807b3ab..cc48a7b3b 100644 --- a/src/RdKafka/EventConsumer.cs +++ b/src/Confluent.Kafka/EventConsumer.cs @@ -2,7 +2,7 @@ using System.Threading; using System.Threading.Tasks; -namespace RdKafka +namespace Confluent.Kafka { /// /// Kafka Consumer that forwards received messages as events to the application. @@ -50,7 +50,7 @@ public void Start() } else if (mae.Error == ErrorCode._PARTITION_EOF) { - OnEndReached?.Invoke(this, + OnEndReached?.Invoke(this, new TopicPartitionOffset() { Topic = mae.Message.Topic, diff --git a/src/RdKafka/Handle.cs b/src/Confluent.Kafka/Handle.cs similarity index 99% rename from src/RdKafka/Handle.cs rename to src/Confluent.Kafka/Handle.cs index 99ce02aed..6564acad2 100644 --- a/src/RdKafka/Handle.cs +++ b/src/Confluent.Kafka/Handle.cs @@ -4,9 +4,9 @@ using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Threading; -using RdKafka.Internal; +using Confluent.Kafka.Internal; -namespace RdKafka +namespace Confluent.Kafka { /// /// Shared base of and . diff --git a/src/RdKafka/IDeliveryHandler.cs b/src/Confluent.Kafka/IDeliveryHandler.cs similarity index 94% rename from src/RdKafka/IDeliveryHandler.cs rename to src/Confluent.Kafka/IDeliveryHandler.cs index dbc990ae1..b9fb80868 100644 --- a/src/RdKafka/IDeliveryHandler.cs +++ b/src/Confluent.Kafka/IDeliveryHandler.cs @@ -1,6 +1,6 @@ using System; -namespace RdKafka +namespace Confluent.Kafka { /// /// Used by the topics of the producer client to notify on produce request progress. diff --git a/src/RdKafka/Internal/LibRdKafka.cs b/src/Confluent.Kafka/Internal/LibRdKafka.cs similarity index 99% rename from src/RdKafka/Internal/LibRdKafka.cs rename to src/Confluent.Kafka/Internal/LibRdKafka.cs index a38d8b392..e9adb17d8 100644 --- a/src/RdKafka/Internal/LibRdKafka.cs +++ b/src/Confluent.Kafka/Internal/LibRdKafka.cs @@ -6,7 +6,7 @@ using System.Reflection; #endif -namespace RdKafka.Internal +namespace Confluent.Kafka.Internal { internal static class LibRdKafka { @@ -640,7 +640,7 @@ internal static extern IntPtr rd_kafka_brokers_add(IntPtr rk, [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rd_kafka_outq_len(IntPtr rk); - + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rd_kafka_wait_destroyed(IntPtr timeout_ms); } diff --git a/src/RdKafka/Internal/Metadata.cs b/src/Confluent.Kafka/Internal/Metadata.cs similarity index 98% rename from src/RdKafka/Internal/Metadata.cs rename to src/Confluent.Kafka/Internal/Metadata.cs index 55643d2b8..88691ecc4 100644 --- a/src/RdKafka/Internal/Metadata.cs +++ b/src/Confluent.Kafka/Internal/Metadata.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace RdKafka.Internal +namespace Confluent.Kafka.Internal { [StructLayout(LayoutKind.Sequential)] struct rd_kafka_metadata_broker { diff --git a/src/RdKafka/Internal/SafeConfigHandle.cs b/src/Confluent.Kafka/Internal/SafeConfigHandle.cs similarity index 99% rename from src/RdKafka/Internal/SafeConfigHandle.cs rename to src/Confluent.Kafka/Internal/SafeConfigHandle.cs index 98709ac65..c866982da 100644 --- a/src/RdKafka/Internal/SafeConfigHandle.cs +++ b/src/Confluent.Kafka/Internal/SafeConfigHandle.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; using System.Text; -namespace RdKafka.Internal +namespace Confluent.Kafka.Internal { enum ConfRes { Unknown = -2, /* Unknown configuration name. */ diff --git a/src/RdKafka/Internal/SafeHandleZeroIsInvalid.cs b/src/Confluent.Kafka/Internal/SafeHandleZeroIsInvalid.cs similarity index 94% rename from src/RdKafka/Internal/SafeHandleZeroIsInvalid.cs rename to src/Confluent.Kafka/Internal/SafeHandleZeroIsInvalid.cs index 958fecb86..222a54b2f 100644 --- a/src/RdKafka/Internal/SafeHandleZeroIsInvalid.cs +++ b/src/Confluent.Kafka/Internal/SafeHandleZeroIsInvalid.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace RdKafka +namespace Confluent.Kafka { abstract class SafeHandleZeroIsInvalid : SafeHandle { diff --git a/src/RdKafka/Internal/SafeKafkaHandle.cs b/src/Confluent.Kafka/Internal/SafeKafkaHandle.cs similarity index 99% rename from src/RdKafka/Internal/SafeKafkaHandle.cs rename to src/Confluent.Kafka/Internal/SafeKafkaHandle.cs index 42d9d7166..cf8e3e159 100644 --- a/src/RdKafka/Internal/SafeKafkaHandle.cs +++ b/src/Confluent.Kafka/Internal/SafeKafkaHandle.cs @@ -4,7 +4,7 @@ using System.Text; using System.Runtime.InteropServices; -namespace RdKafka.Internal +namespace Confluent.Kafka.Internal { enum RdKafkaType { diff --git a/src/RdKafka/Internal/SafeTopicConfigHandle.cs b/src/Confluent.Kafka/Internal/SafeTopicConfigHandle.cs similarity index 99% rename from src/RdKafka/Internal/SafeTopicConfigHandle.cs rename to src/Confluent.Kafka/Internal/SafeTopicConfigHandle.cs index cb271ff14..25902699d 100644 --- a/src/RdKafka/Internal/SafeTopicConfigHandle.cs +++ b/src/Confluent.Kafka/Internal/SafeTopicConfigHandle.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; using System.Text; -namespace RdKafka.Internal +namespace Confluent.Kafka.Internal { internal sealed class SafeTopicConfigHandle : SafeHandleZeroIsInvalid { diff --git a/src/RdKafka/Internal/SafeTopicHandle.cs b/src/Confluent.Kafka/Internal/SafeTopicHandle.cs similarity index 97% rename from src/RdKafka/Internal/SafeTopicHandle.cs rename to src/Confluent.Kafka/Internal/SafeTopicHandle.cs index a9ba37679..8fa9d2fce 100644 --- a/src/RdKafka/Internal/SafeTopicHandle.cs +++ b/src/Confluent.Kafka/Internal/SafeTopicHandle.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace RdKafka.Internal +namespace Confluent.Kafka.Internal { enum MsgFlags { @@ -9,7 +9,7 @@ enum MsgFlags MSG_F_COPY = 2, MSG_F_BLOCK = 4 } - + internal sealed class SafeTopicHandle : SafeHandleZeroIsInvalid { const int RD_KAFKA_PARTITION_UA = -1; @@ -36,7 +36,7 @@ internal long Produce(byte[] payload, int payloadCount, byte[] key, int keyCount payload, (UIntPtr) payloadCount, key, (UIntPtr) keyCount, opaque); - + internal bool PartitionAvailable(int partition) => LibRdKafka.topic_partition_available(handle, partition); } } diff --git a/src/RdKafka/Library.cs b/src/Confluent.Kafka/Library.cs similarity index 97% rename from src/RdKafka/Library.cs rename to src/Confluent.Kafka/Library.cs index 8d25be75c..800fb4e7c 100644 --- a/src/RdKafka/Library.cs +++ b/src/Confluent.Kafka/Library.cs @@ -1,8 +1,8 @@ using System; using System.Runtime.InteropServices; -using RdKafka.Internal; +using Confluent.Kafka.Internal; -namespace RdKafka +namespace Confluent.Kafka { /// /// Miscellaneous APIs for the RdKafka library itself. diff --git a/src/RdKafka/Message.cs b/src/Confluent.Kafka/Message.cs similarity index 95% rename from src/RdKafka/Message.cs rename to src/Confluent.Kafka/Message.cs index e427533b8..6c9ed3761 100644 --- a/src/RdKafka/Message.cs +++ b/src/Confluent.Kafka/Message.cs @@ -1,4 +1,4 @@ -namespace RdKafka +namespace Confluent.Kafka { public struct Message { diff --git a/src/RdKafka/Metadata.cs b/src/Confluent.Kafka/Metadata.cs similarity index 99% rename from src/RdKafka/Metadata.cs rename to src/Confluent.Kafka/Metadata.cs index bc735a4e0..ebb26c768 100644 --- a/src/RdKafka/Metadata.cs +++ b/src/Confluent.Kafka/Metadata.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace RdKafka +namespace Confluent.Kafka { public struct Metadata { diff --git a/src/RdKafka/Offset.cs b/src/Confluent.Kafka/Offset.cs similarity index 96% rename from src/RdKafka/Offset.cs rename to src/Confluent.Kafka/Offset.cs index c0a3c36fd..97280eaa0 100644 --- a/src/RdKafka/Offset.cs +++ b/src/Confluent.Kafka/Offset.cs @@ -1,5 +1,5 @@ -namespace RdKafka +namespace Confluent.Kafka { public static class Offset { diff --git a/src/RdKafka/Producer.cs b/src/Confluent.Kafka/Producer.cs similarity index 96% rename from src/RdKafka/Producer.cs rename to src/Confluent.Kafka/Producer.cs index f02fa0a2a..f52dfb44c 100644 --- a/src/RdKafka/Producer.cs +++ b/src/Confluent.Kafka/Producer.cs @@ -1,8 +1,8 @@ using System; using System.Runtime.InteropServices; -using RdKafka.Internal; +using Confluent.Kafka.Internal; -namespace RdKafka +namespace Confluent.Kafka { /// /// High-level, asynchronous message producer. diff --git a/src/RdKafka/RdKafkaException.cs b/src/Confluent.Kafka/RdKafkaException.cs similarity index 93% rename from src/RdKafka/RdKafkaException.cs rename to src/Confluent.Kafka/RdKafkaException.cs index 64d39c2c4..98713f718 100644 --- a/src/RdKafka/RdKafkaException.cs +++ b/src/Confluent.Kafka/RdKafkaException.cs @@ -1,8 +1,8 @@ using System; using System.Runtime.InteropServices; -using RdKafka.Internal; +using Confluent.Kafka.Internal; -namespace RdKafka +namespace Confluent.Kafka { public class RdKafkaException : Exception { diff --git a/src/RdKafka/Topic.cs b/src/Confluent.Kafka/Topic.cs similarity index 94% rename from src/RdKafka/Topic.cs rename to src/Confluent.Kafka/Topic.cs index 4fe012d38..668379a8c 100644 --- a/src/RdKafka/Topic.cs +++ b/src/Confluent.Kafka/Topic.cs @@ -1,9 +1,9 @@ using System; using System.Runtime.InteropServices; using System.Threading.Tasks; -using RdKafka.Internal; +using Confluent.Kafka.Internal; -namespace RdKafka +namespace Confluent.Kafka { public struct DeliveryReport { @@ -19,7 +19,7 @@ public class Topic : IDisposable private sealed class TaskDeliveryHandler : TaskCompletionSource, IDeliveryHandler { } - + const int RD_KAFKA_PARTITION_UA = -1; internal readonly SafeTopicHandle handle; @@ -75,14 +75,14 @@ public Task Produce(byte[] payload, int payloadCount, byte[] key } /// - /// Produces a keyed message to a partition of the current Topic and notifies the caller of progress via a callback interface. + /// Produces a keyed message to a partition of the current Topic and notifies the caller of progress via a callback interface. /// /// Payload to send to Kafka. Can be null. /// IDeliveryHandler implementation used to notify the caller when the given produce request completes or an error occurs. /// (Optional) The key associated with (or null if no key is specified). /// (Optional) The topic partition to which will be sent (or -1 if no partition is specified). /// Thrown if is null. - /// Methods of will be executed in an RdKafka-internal thread and will block other operations - consider this when implementing IDeliveryHandler. + /// Methods of will be executed in an RdKafka internal thread and will block other operations - consider this when implementing IDeliveryHandler. /// Use this overload for high-performance use cases as it does not use TPL and reduces the number of allocations. public void Produce(byte[] payload, IDeliveryHandler deliveryHandler, byte[] key = null, Int32 partition = RD_KAFKA_PARTITION_UA, bool blockIfQueueFull = true) { @@ -90,7 +90,7 @@ public void Produce(byte[] payload, IDeliveryHandler deliveryHandler, byte[] key } /// - /// Produces a keyed message to a partition of the current Topic and notifies the caller of progress via a callback interface. + /// Produces a keyed message to a partition of the current Topic and notifies the caller of progress via a callback interface. /// /// Payload to send to Kafka. Can be null. /// Number of bytes to use from payload buffer diff --git a/src/RdKafka/TopicConfig.cs b/src/Confluent.Kafka/TopicConfig.cs similarity index 94% rename from src/RdKafka/TopicConfig.cs rename to src/Confluent.Kafka/TopicConfig.cs index 5c6d52586..aaa297662 100644 --- a/src/RdKafka/TopicConfig.cs +++ b/src/Confluent.Kafka/TopicConfig.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using RdKafka.Internal; +using Confluent.Kafka.Internal; -namespace RdKafka +namespace Confluent.Kafka { /// /// Topic-specific configuration. @@ -46,7 +46,7 @@ public string this[string name] /// it may be called multiple times for the same message/key. /// /// Partitioner function constraints: - /// - MUST NOT call any RdKafka methods except for + /// - MUST NOT call any Confluent.Kafka methods except for /// Topic.PartitionAvailable /// - MUST NOT block or execute for prolonged periods of time. /// - MUST return a value between 0 and partition_cnt-1, or the @@ -57,7 +57,7 @@ public string this[string name] /// /// Sets a custom Partitioner - /// delegate to control assignment of messages to partitions. + /// delegate to control assignment of messages to partitions. /// /// See Topic.Produce for details. /// diff --git a/src/RdKafka/project.json b/src/Confluent.Kafka/project.json similarity index 72% rename from src/RdKafka/project.json rename to src/Confluent.Kafka/project.json index 2a96e75eb..3f754985a 100644 --- a/src/RdKafka/project.json +++ b/src/Confluent.Kafka/project.json @@ -2,9 +2,9 @@ "version": "0.9.2-*", "packOptions": { - "description": "C# Apache Kafka client", - "authors": ["Andreas Heider"], - "tags": ["kafka", "rdkafka"] + "description": ".NET Apache Kafka client", + "authors": ["Andreas Heider", "Confluent Inc"], + "tags": ["kafka", "librdkafka", "confluent"] }, "dependencies": { diff --git a/test/RdKafka.Tests/ConfigTests.cs b/test/Confluent.Kafka.Tests/ConfigTests.cs similarity index 95% rename from test/RdKafka.Tests/ConfigTests.cs rename to test/Confluent.Kafka.Tests/ConfigTests.cs index 85bc2b0e4..cbbaec6d9 100644 --- a/test/RdKafka.Tests/ConfigTests.cs +++ b/test/Confluent.Kafka.Tests/ConfigTests.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using Xunit; -using RdKafka; +using Confluent.Kafka; -namespace RdKafka.Tests +namespace Confluent.Kafka.Tests { public class ConfigTests { diff --git a/test/RdKafka.Tests/RdKafka.Tests.xproj b/test/Confluent.Kafka.Tests/Confluent.Kafka.Test.xproj similarity index 95% rename from test/RdKafka.Tests/RdKafka.Tests.xproj rename to test/Confluent.Kafka.Tests/Confluent.Kafka.Test.xproj index 41016a997..85ccd696b 100644 --- a/test/RdKafka.Tests/RdKafka.Tests.xproj +++ b/test/Confluent.Kafka.Tests/Confluent.Kafka.Test.xproj @@ -7,7 +7,7 @@ 33151be2-c10b-41bc-8c5e-e55211a1722d - RdKafka.Tests + Confluent.Kafka.Tests ..\..\artifacts\obj\$(MSBuildProjectName) .\bin\ diff --git a/test/RdKafka.Tests/project.json b/test/Confluent.Kafka.Tests/project.json similarity index 76% rename from test/RdKafka.Tests/project.json rename to test/Confluent.Kafka.Tests/project.json index 4440ae03b..d6d2dff2f 100644 --- a/test/RdKafka.Tests/project.json +++ b/test/Confluent.Kafka.Tests/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "RdKafka": { + "Confluent.Kafka": { "target": "project" } }, @@ -15,10 +15,10 @@ "xunit": "2.1.0", "dotnet-test-xunit": "1.0.0-rc2-build10025" }, - "imports": [ - "dnxcore50", - "portable-net45+win8" - ] + "imports": [ + "dnxcore50", + "portable-net45+win8" + ] } }, "testRunner": "xunit"