recorder: 1.2.0 - Fixed implementation (``User`` was not used!)
authorKai Moritz <kai@juplo.de>
Wed, 5 Jun 2024 21:02:25 +0000 (23:02 +0200)
committerKai Moritz <kai@juplo.de>
Thu, 6 Jun 2024 18:56:50 +0000 (20:56 +0200)
* The introduced domain-class `User` was not used for serialization.
* _Note:_ The test-case did *not* revealed this!

src/main/java/de/juplo/kafka/wordcount/recorder/RecorderApplication.java
src/main/java/de/juplo/kafka/wordcount/recorder/RecorderController.java

index 6702a70..699c671 100644 (file)
@@ -17,7 +17,7 @@ import java.util.Properties;
 public class RecorderApplication
 {
        @Bean(destroyMethod = "close")
-       KafkaProducer<String, Recording> producer(RecorderApplicationProperties properties)
+       KafkaProducer<User, Recording> producer(RecorderApplicationProperties properties)
        {
                Assert.hasText(properties.getBootstrapServer(), "juplo.wordcount.recorder.bootstrap-server must be set");
 
index c9d2109..8df5242 100644 (file)
@@ -18,12 +18,12 @@ import jakarta.validation.constraints.NotEmpty;
 public class RecorderController
 {
   private final String topic;
-  private final KafkaProducer<String, Recording> producer;
+  private final KafkaProducer<User, Recording> producer;
 
 
   public RecorderController(
       RecorderApplicationProperties properties,
-      KafkaProducer<String,Recording> producer)
+      KafkaProducer<User, Recording> producer)
   {
     this.topic = properties.getTopic();
     this.producer = producer;
@@ -46,9 +46,9 @@ public class RecorderController
   {
     DeferredResult<ResponseEntity<RecordingResult>> result = new DeferredResult<>();
 
-    ProducerRecord<String, Recording> record = new ProducerRecord<>(
+    ProducerRecord<User, Recording> record = new ProducerRecord<>(
         topic,
-        username,
+        User.of(username),
         Recording.of(username, sentence));
 
     producer.send(record, (metadata, exception) ->