Kafka - how to read all messages from compacted topics with enable transaction

29 Views Asked by At

I want to read all messages from Kafka Compacted topic by dynamic created consumer, and I found an interesting article explaining how to do it.

[https://stackoverflow.com/questions/54623123/how-to-read-all-the-records-in-a-kafka-topic ](How to read all messages)

My problem is that when I use transactions, the condition in the code from the article stops in an infinite while loop, and the comment below says that with transactions you need to give a different condition.

Unfortunately, I do not know how to define the exit condition from the loop to make sure that the topic has been read in its entirety, since offsets with transactions may not be linear.

0

There are 0 best solutions below