-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
26 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,5 +47,4 @@ app: | |
messaging: | ||
topics: | ||
SENSOR_DATA: | ||
name: sensor-data | ||
partition-key: partitionKey | ||
name: sensor-data |
7 changes: 0 additions & 7 deletions
7
...erator/src/test/java/com/maemresen/k8s/workshop/data/generator/itest/KafkaTestConfig.java
This file was deleted.
Oops, something went wrong.
57 changes: 0 additions & 57 deletions
57
...r/src/test/java/com/maemresen/k8s/workshop/data/generator/itest/SensorDataProducerIT.java
This file was deleted.
Oops, something went wrong.
Empty file.
12 changes: 0 additions & 12 deletions
12
module/app/data-generator/src/test/resources/sensor-data-1.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
...aging-starter/src/main/java/com/maemresen/k8s/workshop/messaging/starter/KafkaConfig.java
This file was deleted.
Oops, something went wrong.
30 changes: 24 additions & 6 deletions
30
...rc/main/java/com/maemresen/k8s/workshop/messaging/starter/MessagingAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,35 @@ | ||
package com.maemresen.k8s.workshop.messaging.starter; | ||
|
||
import org.apache.kafka.clients.admin.NewTopic; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.kafka.config.TopicBuilder; | ||
import org.springframework.kafka.core.KafkaAdmin; | ||
|
||
@Configuration | ||
public class MessagingAutoConfiguration { | ||
|
||
@ConfigurationProperties(prefix = "app.messaging") | ||
@ConditionalOnMissingBean | ||
@Bean | ||
public MessagingProps messagingProps() { | ||
return new MessagingProps(); | ||
} | ||
@ConfigurationProperties(prefix = "app.messaging") | ||
@ConditionalOnMissingBean | ||
@Bean | ||
public MessagingProps messagingProps() { | ||
return new MessagingProps(); | ||
} | ||
|
||
@Bean | ||
public KafkaAdmin.NewTopics topics() { | ||
return new KafkaAdmin.NewTopics(messagingProps().getTopics() | ||
.values() | ||
.stream() | ||
.map(this::newTopic) | ||
.toArray(NewTopic[]::new)); | ||
|
||
} | ||
|
||
private NewTopic newTopic(final MessagingProps.TopicProps topicProps) { | ||
return TopicBuilder.name(topicProps.name()) | ||
.build(); | ||
} | ||
} |