'How do you configure Spring Cloud Sleuth kafka zipkin sender to reduce the retention period?
I'm trying to set up so that when I deploy a new environment the zipkin Kafka topic used by spring cloud sleuth zipkin sender would have a low retention period since it will get processed by something else or it will be ignored (on the developer machine).
I tried to add this
@Bean("zipkin")
public NewTopic zipkin() {
return TopicBuilder.name("zipkin")
.config(TopicConfig.RETENTION_MS_CONFIG, String.valueOf(Duration.ofMinutes(2).getSeconds() * 1000))
.compact()
.replicas(1)
.build();
}
but that didn't work because the topic is already created and the configured already. I know I can do
kafka-configs --bootstrap-server $_KAFKA_BOOTSTRAP_SERVER --alter --topic zipkin --add-config retention.ms=2000
But I'd want it set up on the Spring application.
Solution 1:[1]
You'll need to use an AdminClient instance to modify existing topic configurations
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | OneCricketeer |
