-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Add config property for KafkaAdmin modifyTopicConfigs #31679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add config property for KafkaAdmin modifyTopicConfigs #31679
Conversation
Thanks for the proposal. We can consider this for 3.0.x but it's too late now for 2.7.x, particular given that it's only a few lines of code to define your own public KafkaAdmin kafkaAdmin(KafkaProperties properties) {
KafkaAdmin kafkaAdmin = new KafkaAdmin(properties.buildAdminProperties());
kafkaAdmin.setFatalIfBrokerNotAvailable(properties.getAdmin().isFailFast());
kafkaAdmin.setModifyTopicConfigs(true);
return kafkaAdmin;
} @garyrussell do you think it makes sense to surface a configuration property for this setting? |
@wilkinsona The reason I would have liked it as configuration property is to make it easily configurable in a k8s environment. |
@m-kay Until Boot has a property, you can externalise it using your own property. You could even name that property |
Yes sure I can do that. I just thought I could also help others with this small change here 😉 |
Yes, it makes sense to add it. Perhaps a simpler work around (without having to add your own @Bean
public NewTopic topic(KafkaAdmin admin) {
admin.setModifyTopicConfigs(true);
return TopicBuilder.name("topic1")
.partitions(1)
.replicas(1)
.config("retention.ms", "60000")
.build();
} |
Thanks, Gary. We'll add the property in 3.0. FWIW, that mutation feels a little risky to me as its ordering with respect to other usages of |
I agree, in general, but in this case it's safe because |
@m-kay thank you for making your first contribution to Spring Boot. |
Adds a new configuration property
spring.kafka.admin.modify-topic-configs
to facilitate enabling of this recently added functionality