I have a need to consume last N messages from a Kafka topic.
The topic has M partitions, each due to whatever reason has more or less messages than others. In other words, messages are not evenly distributed across partitions.
What would be the logic (let it be pseudo code) that achieve this goal?
Thanks.