-
Notifications
You must be signed in to change notification settings - Fork 881
RdKafka -> Confluent.Kafka #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Looks like there are still some RdKafka references that aren't for the underlying librdkafka:
Some are definitely user-facing (e.g. |
@ewencp yeah - on the todo list is to think very carefully about exceptions. Some are direct wrappers around errors from librdkafka, others are not. for the former, the naming RdKafkaException may be more appropriate. I decided to leave RdKafkaException as is for now. |
maybe the exception exposed to the user is never directly RdKafkaException, but maybe the exception that is has this as a child (in which case we still want it). likewise with LibRdKafka, the Rd is appropriate i think as it relates to librdkafka. |
@mhowlett The main distinction in the code seems to be that stuff directly related to librdkafka uses LibRdKafka whereas things that are for the rdkafka-dotnet library use an unprefixed RdKafka. So RdKafkaException is the public interface users of rdkafka-dotnet care about. Elsewhere we've tried to simplify the naming to not be specific to librdkafka (which we consider an implementation detail, though a very excellent implementation detail). e.g., see |
@ewencp I think we need a KafkaException for sure (in fact i originally renamed RdKafkaException to that but changed it back). More specifically Confluent.Kafka.KafkaException. There is also a place for Confluent.Kafka.LibRdKafka.RdKafkaException (or something) i think. I was avoided making decisions around this in this PR - I think that is big enough for it's own PR as it involves carefully reviewing all usages of exceptions thoughout rdkafka-net. |
And yes, RdKafkaException shouldn't be part of the public interface... (except as a child of KafkaException - analogous things elsewhere in .NET libraries). |
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}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a new project uuid generated?
(I have no idea if it has any significance, but it looks random enough to be assumed as unique)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly. But I've done this sort of rename before a lot and never had problems and I'm also pretty sure that if you rename a project within VS it doesn't change the guid. I haven't been using VS yet (this was just a text editor change).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't worried about a plain renaming so much as if someone tries to open both rdkafka-dotnet and confluent-kafka-dotnet in the same IDE. Will they be treated as unique projects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there would only potentially be problems if someone tried to add both projects to the same solution (they should never want to - maybe they want to link against the two libraries, but that is different). In the event they do, I just checked and VS automatically generates new guids, it doesn't let them conflict.
README.md
Outdated
**confluent-kafka-dotnet** is a C# client for [Apache Kafka](http://kafka.apache.org/) based on [librdkafka](https://github.com/edenhill/librdkafka). | ||
|
||
Copyright (c) 2015-2016, [Andreas Heider](mailto:[email protected]) | ||
Forked from [rdkafka-net](https://github.com/ah-/rdkafka-net) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
..-dotnet
Also mention Andreas ("by Andreas Heider").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good points.
|
||
## Examples | ||
|
||
### Producing messages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you are removing this due to later API changes, but maybe keep a FIXME so we wont forget adding examples back in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guarantee you I won't forget to add examples back in... in fact, more likely to be reminded to do so by having nothing than something (that's wrong).
doc/index.md
Outdated
================================================= | ||
|
||
**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 C# client for [Apache Kafka](http://kafka.apache.org/) based on [librdkafka](https://github.com/edenhill/librdkafka). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some updates are C# -> .NET. Here C# is left unchanged.
What should be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. We should use .NET i think. (also changed in the project file).
/// <summary>Queue is full</summary> | ||
_QUEUE_FULL = -184, | ||
/// <summary>ISR count < required.acks</summary> | ||
_ISR_INSUFF = -183, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these indentation changes because you are using another editor?
Which one are you using?
We should probably have it match VS 2015 behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the original is screwed up in my VS with the standard tab size of 4 (I just booted it up to check, but I remember this from before). With the changes i made it displays correctly both in VS with tab spacing of 4 and my VS code where I set the tab size to 2. Based on that I don't know where his file would display correctly.
/// <summary> | ||
/// Internal errors to rdkafka are prefixed with _ | ||
/// </summary> | ||
public enum ErrorCode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to expose these programmatically?
This is an ever-increasing list and librdkafka already provides APIs to extract constant names, description, and value.
This is what I'm doing in the Go client:
https://github.com/confluentinc/confluent-kafka-go/blob/master/kafka/go_rdkafka_generr/go_rdkafka_generr.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's possible to create an ErrorCode enum type at runtime from string/int values obtained from librdkafka. this might be something we want to do if we never want to expose the type to the user of the library (we want to though, right?). C# has 'dynamic' variables (duck typing) which means you can actually statically reference the dynamically generated enum values, but you loose IDE integration of course (and I think it's not really nice to include dynamic vars as part of the API, and no one else does).
we could also auto generate the enum by parsing librdkafka source ... again not something we want to do I think.
internal static extern void rd_kafka_set_log_level(IntPtr rk, IntPtr level); | ||
|
||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] | ||
internal static extern IntPtr rd_kafka_outq_len(IntPtr rk); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to use the librdkafka rdkafka.h header file instead of duplicating the prototypes here?
Even though the API is stable this does seem a bit error prone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to my knowledge. I've always seen it done like this.
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}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need new project UUIDs? Not sure how these are used exactly, but I'd guess that if we keep them the same it could cause conflicts with an rdkafka-dotnet checkout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see other comment
README.md
Outdated
## Usage | ||
|
||
Just reference the [RdKafka NuGet package](https://www.nuget.org/packages/RdKafka) | ||
Just reference the [conflent-kafka-dotnet NuGet package](https://www.nuget.org/packages/confluent-kafka-dotnet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: conflent -> confluent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
Just reference the [RdKafka NuGet package](https://www.nuget.org/packages/RdKafka) | ||
Just reference the [conflent-kafka-dotnet NuGet package](https://www.nuget.org/packages/confluent-kafka-dotnet) | ||
|
||
## Examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're stripping out the contents of these sections can we drop them entirely? We can always restore them later (and we should file a JIRA to track that if we need to follow up later once we've cleaned up APIs etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up to you on this one - i don't have an opinion either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM assuming we actually follow up on the rest of the renaming stuff.
@edenhill @ewencp