`ApplicationRecordHandler` gibt auch die Client-ID aus
authorKai Moritz <kai@juplo.de>
Sat, 27 Aug 2022 17:15:32 +0000 (19:15 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 27 Aug 2022 18:20:00 +0000 (20:20 +0200)
* Conflicts:
** src/main/java/de/juplo/kafka/ApplicationRecordHandler.java

src/main/java/de/juplo/kafka/ApplicationConfiguration.java
src/main/java/de/juplo/kafka/ApplicationRecordHandler.java

index 64f8738..e08cff4 100644 (file)
@@ -24,7 +24,8 @@ public class ApplicationConfiguration
   {
     return new ApplicationRecordHandler(
         adderResults,
-        Optional.ofNullable(properties.getThrottle()));
+        Optional.ofNullable(properties.getThrottle()),
+        properties.getClientId());
   }
 
   @Bean
index 0f5b982..51d524f 100644 (file)
@@ -16,6 +16,7 @@ public class ApplicationRecordHandler implements RecordHandler<String, String>
 {
   private final AdderResults results;
   private final Optional<Duration> throttle;
+  private final String id;
 
   private final Map<Integer, AdderBusinessLogic> state = new HashMap<>();
 
@@ -30,7 +31,7 @@ public class ApplicationRecordHandler implements RecordHandler<String, String>
     if (message.equals("CALCULATE"))
     {
       AdderResult result = state.get(partition).calculate(user);
-      log.info("New result for {}: {}", user, result);
+      log.info("{} - New result for {}: {}", id, user, result);
       results.addResults(partition, user, result);
     }
     else
@@ -46,7 +47,7 @@ public class ApplicationRecordHandler implements RecordHandler<String, String>
       }
       catch (InterruptedException e)
       {
-        log.warn("Intrerrupted while throttling: {}", e);
+        log.warn("{} - Intrerrupted while throttling: {}", id, e);
       }
     }
   }