I have the following problem. I need to set the retention time in Kafka for certain selected topics. I found a solution where I can set it with the following command:
kafka-topics --zookeeper localhost:2181 --alter --topic topic-name --config retention.ms=-1
I checked in Kafka's Web UI and confirmed that it got changed.
If possible, I want to set the retention time in Java myself, but I can't seem to find the appropriate class/configuration to set the time. I thought I could get the information about the retention in the ProducerConfig class, but I couldn't find it there.
Is it even possible to set the retention time in Java and if possible, how can I get it done?
Thanks in advance!