How can I access the list of uncommitted messages in a topic in kafka?

Solution 1:

To access uncommitted messages, first assumes you are committing. Otherwise, you're just consuming a topic.

The only way to get any records from Kafka is by using consumer api.

Commits aren't required (disable auto commit and don't explicitly call commit methods in code). However, if the app restarts for any reason, the auto.offset.reset property will always apply to any topic you're consuming, meaning you either skip everything or have to block your main code execution until this consumer reads everything from the beginning of the topic. One popular app that doesn't commit any offsets or create a consumer group is the Confluent Schema Registry. Kafka Streams changelog topics also do this.

If you want "another consumer" to read the entire topic, it needs to have a different group id. That's it