question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ConsumerGroupMetadata is internal and there is no (clean) way for an external library to wrap it

See original GitHub issue

IConsumerGroupMetadata is an empty interface, that does not have a public property/method to access the metadata itself, while ConsumerGroupMetadata has an internal field containing the serialized version of metadata.

https://github.com/confluentinc/confluent-kafka-dotnet/blob/2b54dd2ab07f6eaa886d88c57143838627b2512f/src/Confluent.Kafka/ConsumerGroupMetadata.cs#L23

Due to this design, the only way to get metadata of a consumer group is to cast IConsumerGroupMetadata to ConsumerGroupMetadata.

https://github.com/confluentinc/confluent-kafka-dotnet/blob/2b54dd2ab07f6eaa886d88c57143838627b2512f/src/Confluent.Kafka/Impl/SafeKafkaHandle.cs#L553

A better way to do it would be to have a public property to get metadata as byte[] in IConsumerGroupMetadata itself. Please, consider this change.

P.S. I will try to do these changes in my free time, but maybe there is a samaritan that could do this now.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
agayev169commented, Feb 10, 2021

@agayev169 The ConsumerGroupMetadata’s purpose is to pass consumer group state from a consumer to a transactional producer, the state information is of no use to the application and thus there’s no reason to expose it.

I get your point, and partially agree with you on this point; however, let’s consider my case. I am trying to develop a service using Kafka. I do not want to leave Kafka dependencies in the public API of the service (maybe it will be change in the future, who knows), so I tried to wrap all the components that I need under my own public API (consumer, producer, message, etc.). The only problem that I faced till now is that I cannot wrap the ICosumerGroupMetadata since it does not let me get the metadata itself from my service (both ConsumerGroupMetadata and variable storing metadata are internal).

So, what I find missing is a public method that would let me get the metadata as byte[].

1reaction
mhowlettcommented, Feb 10, 2021

the java client actually exposes information on the instance returned from groupMetadata, which is what is passed to the transactional producer. whether on not this is really useful (seems like @agayev169 want’s it), our api does expose less than the Java one does.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.ClassNotFoundException: org.apache.kafka. ...
I am getting the following error when I try to run my application. Caused by: java.lang.ClassNotFoundException: org.apache.kafka.clients.
Read more >
Wrapping third party library is best practice [duplicate]
When you wrap a third-party API, you minimize your dependencies upon it: You can choose to move to a different library in the...
Read more >
[Clean Practices] - Avoid your code marrying 3rd party ...
Consider pushing all facade wrapping external library to a new package all together. This way its pretty easy to change/upgrade the external ......
Read more >
I'm trying to wrap my mind around what is considered ...
Hey Courtney, you will be fine to import in Collections, they are part of the JDK version that you download, so considered an...
Read more >
How to setup Composer and use external libraries in ...
Another problem of wrapping packages is that you cannot get updates without the wrapping module being updated. There is also lot's of tooling ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found