I have a Kafka topic that receives many many messages. Many of them have the same key and I'm interested only in the latest messages. Looking around this topic seems perfect for the config log.cleanup.policy=compact.
Can I change the existing Kafka topic configuration adding/changing config log.cleanup.policy=compact or I have to create a new topic?
I tried to create a new topic with:
bin/kafka-topics.sh --create --topic compactedPricing \
--partitions 1 --replication-factor 1 \
--config cleanup.policy=compact \
--config min.cleanable.dirty.ratio=0.001 \
--config segment.ms=5000 \
--bootstrap-server localhost:9094
but I received the following error:
[2022-10-25 16:01:40,114] ERROR org.apache.kafka.common.errors.TopicAuthorizationException: Authorization failed.
So, is necessary to have a peculiar authorization?
And, in any case, how can I do it?
Apparently using --alter to change topic configs is no longer supported for newer versions:
The only way I managed to change this config was deleting the topic and recreating it: