How does Kafka Stream retain older msgs that retention policy?

I was going through a Kafka tutorial for counting msg in topic using ksql stream and table and could not understand 1 aspect…it says that we cannot directly refer offset in topic coz of topic retention policy…and instead create stream over that same topic and use count function… However that stream will be backed by same Kafka topic so how will it retain older msgs than retention policy configured…what am i missing here ?

Hi Darshan, I think the idea is that some messages might have already been removed, based on retention policy, and so using the offset won’t give us an accurate count of the messages currently in the topic.