From 80228c42df19f61f868de9d72afb655a3e6c0576 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 27 Aug 2022 19:15:32 +0200 Subject: [PATCH] `ApplicationRecordHandler` gibt auch die Client-ID aus * Conflicts: ** src/main/java/de/juplo/kafka/ApplicationRecordHandler.java --- src/main/java/de/juplo/kafka/ApplicationConfiguration.java | 3 ++- src/main/java/de/juplo/kafka/ApplicationRecordHandler.java | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java index 64f8738..e08cff4 100644 --- a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java +++ b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java @@ -24,7 +24,8 @@ public class ApplicationConfiguration { return new ApplicationRecordHandler( adderResults, - Optional.ofNullable(properties.getThrottle())); + Optional.ofNullable(properties.getThrottle()), + properties.getClientId()); } @Bean diff --git a/src/main/java/de/juplo/kafka/ApplicationRecordHandler.java b/src/main/java/de/juplo/kafka/ApplicationRecordHandler.java index 0f5b982..51d524f 100644 --- a/src/main/java/de/juplo/kafka/ApplicationRecordHandler.java +++ b/src/main/java/de/juplo/kafka/ApplicationRecordHandler.java @@ -16,6 +16,7 @@ public class ApplicationRecordHandler implements RecordHandler { private final AdderResults results; private final Optional throttle; + private final String id; private final Map state = new HashMap<>(); @@ -30,7 +31,7 @@ public class ApplicationRecordHandler implements RecordHandler 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 } catch (InterruptedException e) { - log.warn("Intrerrupted while throttling: {}", e); + log.warn("{} - Intrerrupted while throttling: {}", id, e); } } } -- 2.20.1