Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ private static void ensureTopicsExist(Properties streamsProps) {
KafkaEnvProps.apply(adminProps);
adminProps.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);

int partitions = Integer.parseInt(
System.getenv().getOrDefault("KAFKA_TOPIC_PARTITIONS", "1"));
short replicationFactor = Short.parseShort(
System.getenv().getOrDefault("KAFKA_TOPIC_REPLICATION_FACTOR", "3"));
Comment on lines +153 to +155

List<String> requiredTopics = new java.util.ArrayList<>(List.of(
Topics.MESSAGE_INPUT,
Topics.ENRICHED_MESSAGE_INPUT,
Expand All @@ -174,7 +179,7 @@ private static void ensureTopicsExist(Properties streamsProps) {

List<NewTopic> toCreate = requiredTopics.stream()
.filter(t -> !existing.contains(t))
.map(t -> new NewTopic(t, 1, (short) 1))
.map(t -> new NewTopic(t, partitions, replicationFactor))
.collect(Collectors.toList());

if (!toCreate.isEmpty()) {
Expand Down
Loading