Skip to content

Instantly share code, notes, and snippets.

@schroedermatt
Last active July 24, 2018 20:22
Show Gist options
  • Save schroedermatt/7a60d8cd1e29c6282e97536278d8c1b2 to your computer and use it in GitHub Desktop.
Save schroedermatt/7a60d8cd1e29c6282e97536278d8c1b2 to your computer and use it in GitHub Desktop.
Spring Kafka Config blog
kafka:
topics:
-
name: testing-auto-setup
num-partitions: 5
replication-factor: 1
-
name: another-test
num-partitions: 3
replication-factor: 1
@Configuration
@ConfigurationProperties(prefix = "kafka")
class TopicConfigurations {
List<TopicConfiguration> topics;
static class TopicConfiguration {
String name;
Integer numPartitions = 3;
Short replicationFactor = 1;
NewTopic toNewTopic() {
return new NewTopic(this.name, this.numPartitions, this.replicationFactor);
}
}
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment