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.

Consumer constructor is marked internal

See original GitHub issue

Description

Confluent.Kafka 1.0 RC4

Consumer has one constructor that is marked as internal, making it impossible to extend. Is this intended? This forces a developer to wrap the class to associate data with the consumer (changing all the code from consumer.Consume() to consumerWrapper.Consumer.Consume(), for example).

One option is to make the constructor public.

Another option is to seal the class or mark it as internal, only allowing the interface to be used externally, making it clear that the class cannot be inherited.

How to reproduce

The following will not build because the constructor is marked internal.

public class ExtendedConsumer<TKey,TValue> : Consumer<TKey,TValue>
{
    public ExtendedConsumer(ConsumerBuilder<TKey,TValue> builder):base(builder){};
}

Possibly related issues:

https://github.com/confluentinc/confluent-kafka-dotnet/issues/151 https://github.com/confluentinc/confluent-kafka-dotnet/issues/777

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mhowlettcommented, Apr 16, 2019

#888 actions this issue

0reactions
dbrownxccommented, Apr 16, 2019

Understood. Thanks for the explanation!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Consumer Constructor Pitfalls - java
Consumer constructors appear to present a concise way in Java to write code that in other languages would be referred to as "properties"....
Read more >
Dependency injection for a library with internal dependencies
My services have constructor arguments that allow the repositories to be injected into them. But the repositories are internal so the web site ......
Read more >
Using Constructors - C# Programming Guide
Constructors can be marked as public, private, protected, internal, protected internal or private protected. These access modifiers define ...
Read more >
Required members - C# 11.0 draft feature specifications
All constructors in a type with required members, or whose base type specifies required members, must have those members set by a consumer...
Read more >
Interfaces are access modifiers by Mark Seemann - ploeh blog
NET developers should be familiar with the standard access modifiers (public, protected, internal, private). However, in loosely coupled ...
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