I have a spring boot project using Kafka. I configured it with Spring Cloud Stream Kafka auto configuration. I want to create my topics automatically with 3 replicas and 1 day retention. For this I added replication factor and retention.ms to my application.yml like below:
spring:
cloud:
stream:
kafka:
binder:
replicationFactor: 3
default:
consumer:
topic:
properties:
retention.ms: 86400000
producer:
topic:
properties:
retention.ms: 86400000
Actually these work fine for me, topics create as 3 replicas with 1 day retention but when I delete a topic while application running, this topic creates automatically without replica and retention. Anyone know the reason for this? What should I do to create my topics with 3 replicas and 1 day retention at runtime?
Set the broker's auto.create.topics.enable
property to false
.
https://kafka.apache.org/documentation/#brokerconfigs_auto.create.topics.enable