From a927b93e0fe43dd700fe5c121ed79fec4a8867db Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 4 Sep 2022 08:00:08 +0200 Subject: [PATCH] Vorlage --- .../java/de/juplo/kafka/ApplicationConfiguration.java | 6 +----- .../java/de/juplo/kafka/ApplicationRecordHandler.java | 11 +---------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java index 596be26..a769779 100644 --- a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java +++ b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java @@ -92,11 +92,7 @@ public class ApplicationConfiguration props.put("auto.offset.reset", properties.getAutoOffsetReset()); props.put("metadata.max.age.ms", "1000"); props.put("key.deserializer", StringDeserializer.class.getName()); - props.put("value.deserializer", JsonDeserializer.class.getName()); - props.put(JsonDeserializer.TRUSTED_PACKAGES, "de.juplo.kafka"); - props.put(JsonDeserializer.TYPE_MAPPINGS, - Message.Type.ADD + ":" + MessageAddNumber.class.getName() + "," + - Message.Type.CALC + ":" + MessageCalculateSum.class.getName()); + props.put("value.deserializer", "TODO: JsonDeserializer konfigurieren"); return new KafkaConsumer<>(props); } diff --git a/src/main/java/de/juplo/kafka/ApplicationRecordHandler.java b/src/main/java/de/juplo/kafka/ApplicationRecordHandler.java index 2829157..559bd90 100644 --- a/src/main/java/de/juplo/kafka/ApplicationRecordHandler.java +++ b/src/main/java/de/juplo/kafka/ApplicationRecordHandler.java @@ -46,16 +46,7 @@ public class ApplicationRecordHandler implements RecordHandler String user = record.key(); Message message = record.value(); - switch(message.getType()) - { - case ADD: - addNumber(partition, user, (MessageAddNumber) message); - break; - - case CALC: - calculateSum(partition, user, (MessageCalculateSum) message); - break; - } + // TODO: JSON-Nachrichten verarbeiten if (throttle.isPresent()) { -- 2.20.1