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.

KafkaConsumer should not be sealed

See original GitHub issue

KafkaConsumer is a sealed abstract class. That serves no purpose since it is not an enumeration that gets pattern matched somewhere and it has no concrete implementations.

On the flip side, being sealed means you can’t mock it easily for testing. KafkaProducer is also abstract but not sealed.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
vlovgrcommented, Nov 10, 2020

The only gain is that we can keep adding functions to the sealed KafkaConsumer without breaking binary compatibility.

0reactions
bplommercommented, Nov 12, 2020

I’m not sure there’s anything to split here, given the underlying API it provides access to. If admin was there, that would be one thing, but KafkaConsumer is rather focused.

Don’t think I agree. KafkaConsumer has methods for:

  • consuming messages, using streams in various formats
  • subscribing to / unsubscribing from topics
  • manually assigning partitions
  • inspecting assignments
  • adjusting offsets
  • inspecting offsets
  • getting metrics
  • getting a fiber to manually shut down the underlying consumer.

There’s a definite possibility that we’ll want to support new features that are added to Kafka in the future, and/or add higher-level functionality. Splitting out traits also lets us restrict which capabilities we pass around, so makes it easier to reason about what a program does and doesn’t do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

KafkaConsumer (kafka 2.2.0 API)
A client that consumes records from a Kafka cluster. This client transparently handles the failure of Kafka brokers, and transparently adapts as topic ......
Read more >
KafkaConsumer (clients 3.3.1 API) - javadoc.io
A client that consumes records from a Kafka cluster. This client transparently handles the failure of Kafka brokers, and transparently adapts as topic ......
Read more >
Chapter 4. Kafka Consumers: Reading Data from Kafka
There is a fourth property, which is not strictly mandatory, but for now we will pretend it is. The property is group.id and...
Read more >
Kafka Streams vs. Kafka Consumer | Baeldung
It deals with messages as an unbounded, continuous, and real-time flow of records, with the following characteristics: Single Kafka Stream to ...
Read more >
Running kafka consumer(new Consumer API) forever
Consumers are usually long-running applications that continuously poll Kafka for more data. Consumers must keep polling Kafka or they will be considered dead...
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