Home > Software engineering >  How to paginate with apache kafka messages
How to paginate with apache kafka messages

Time:03-22

A pagination system is done with total records and specify offset to start paginate.

How can I get total records and offset in kafka from console?

CodePudding user response:

Kafka doesn't paginate. A topic is a sequential log of events.

However, your consumer group has an initial or stored offset, and on the next poll, will read up to max.poll.records for the next "page" after that offset.

If you want to count the number of records in a non compacted topic, you can use GetOffsetShell tool to query the first and last offset, then subtract the difference. For a compacted topic, there are gaps in those numbers and the only reasonable way to count records is to consume the entire topic

  • Related